* doc/make.texi: GNUMAKEFLAGS is only read from the environment

This commit is contained in:
Paul Smith 2024-09-02 14:53:44 -04:00
parent 0267eb64fa
commit 7dc23aff30

View file

@ -5262,16 +5262,17 @@ itself. For instance, the @samp{-t}, @samp{-n}, and @samp{-q} options, if
put in one of these variables, could have disastrous consequences and would put in one of these variables, could have disastrous consequences and would
certainly have at least surprising and probably annoying effects. certainly have at least surprising and probably annoying effects.
If you'd like to run other implementations of @code{make} in addition If you'd like to run other implementations of @code{make} in addition to GNU
to GNU @code{make}, and hence do not want to add GNU Make, and hence do not want to add GNU Make-specific flags to your
@code{make}-specific flags to the @code{MAKEFLAGS} variable, you can @code{MAKEFLAGS} environment variable, you can add them to the
add them to the @code{GNUMAKEFLAGS} variable instead. This variable @code{GNUMAKEFLAGS} environment variable instead. This is parsed just before
is parsed just before @code{MAKEFLAGS}, in the same way as @code{MAKEFLAGS}, in the same way as @code{MAKEFLAGS}. When @code{make}
@code{MAKEFLAGS}. When @code{make} constructs @code{MAKEFLAGS} to constructs @code{MAKEFLAGS} to pass to a recursive @code{make} it will include
pass to a recursive @code{make} it will include all flags, even those all flags, even those taken from @code{GNUMAKEFLAGS}. As a result, after
taken from @code{GNUMAKEFLAGS}. As a result, after parsing parsing @code{GNUMAKEFLAGS} GNU Make sets this variable to the empty string to
@code{GNUMAKEFLAGS} GNU @code{make} sets this variable to the empty avoid duplicating flags during recursion. Only @code{GNUMAKEFLAGS}
string to avoid duplicating flags during recursion. environment variables are treated specially: setting the @code{make} variable
@code{GNUMAKEFLAGS} has no effect.
It's best to use @code{GNUMAKEFLAGS} only with flags which won't It's best to use @code{GNUMAKEFLAGS} only with flags which won't
materially change the behavior of your makefiles. If your makefiles materially change the behavior of your makefiles. If your makefiles