On Wed, 2023-06-14 at 09:52 -0400, Dmitry Goncharov wrote:
> Prior versions of make ignored the "MAKEFLAGS += --no-print-
> directory" setting.

Just to be very clear, it was ignored for _this_ instance of make, but
was in effect for any _sub-make_ that was invoked.

> if i understood you correctly, you need the message to be printed
> when make changes its cwd and not printed when make stays in its cwd,
> correct?
> Paul, does it look reasonable to you to modify make to avoid printing
> the message when submake stays in the same directory? Does anybody or
> any program need this message when the directory stays? The parent
> make would have to figure out whether to print the message and tell
> the submake.

There's no way the parent make can figure this out on its own.  The
parent make can't know what the recipe will end up doing so it can't
know whether the submake will be invoked in the same directory, or not.

The only possible way this could work would be for the parent make to
tell the sub-make what directory it was invoked in (by passing some
extra environment variable or option for example), then the sub-make
can compare that with its current directory and print the changing
directory string IFF they were not the same.  This of course leads to
all sorts of questions like, what if the paths are different but end up
in the same directory (due to symlinks etc.) or are the same but
textually different (due to "/./" or "../foo" etc.)

As for whether it's reasonable I'm not sure if people are relying on
that behavior even when not changing directories (for example, it can
be helpful when examining make output, to realize that a sub-make was
actually invoked even if it doesn't change the directory).

Reply via email to