freebsd-dev/usr.bin/make
Yaroslav Tykhiy 0c35219978 Don't forget to set MAKEFLAGS in the childs' environment
from the .MAKEFLAGS global variable even if it's empty or
unset.  This means setting MAKEFLAGS to just an empty string
in the latter case.

If not doing so, make(1) behaved inconsistently WRT MAKEFLAGS.
In particular, it would let a `-f foo' option down to sub-makes
if .MAKEFLAGS was unset.  E.g.,

	env MAKEFLAGS="-f mymakefile" make

would pass `-f mymakefile' down to sub-makes via their environment
(unless mymakefile added something to .MAKEFLAGS).
But any additional options appearing would change this behaviour to
not passing `-f mymakefile' to sub-makes, as in:

	env MAKEFLAGS="-f mymakefile" make -D DUMMY

or

	env MAKEFLAGS="-f mymakefile -D DUMMY" make

(unless mymakefile cleared .MAKEFLAGS).

Also make(1) would leave MAKEFLAGS at its initial value if the
makefile set .MAKEFLAGS to an empty value.  I.e., it was impossible
to override MAKEFLAGS with an empty value.  (Note well that makefiles
are not to touch MAKEFLAGS directly, they alter .MAKEFLAGS instead.
So make(1) can filter out things such as -f when copying MAKEFLAGS
to .MAKEFLAGS at startup.  Direct modifications to MAKEFLAGS just go
nowhere.)

While the original intentions of the BSD make authors are somewhat
unclear here, the bug proves that NOT passing -f options down is
the settled behaviour because the opposite behaviour is totally
unreliable in the presence of any other options.  In addition, not
passing down -f's found in the environment is consistent with doing
so WRT the command line.

Update the manpage accordingly and make the whole description of
MAKEFLAGS and .MAKEFLAGS more consistent as this change indeed
brings more consistency into the reliable behaviour of make(1).

Submitted by:	ru (main.c)
Tested with:	make world
2008-03-05 20:11:04 +00:00
..
PSD.doc Remove another unused Makefile. 2003-02-03 04:15:53 +00:00
arch.c <limits.h> is necessary for using INT_MIN, so included it here 2008-03-04 15:56:17 +00:00
arch.h Get rid of the ReturnStatus obscuration that was anyway used only 2005-05-18 06:50:39 +00:00
buf.c Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
buf.h Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
cond.c Under certain conditions the condition parser would go one past end of 2005-05-25 16:06:14 +00:00
cond.h Rework the directive parsing code. Instead of using a lot of strcmp()s 2005-04-11 07:20:10 +00:00
config.h Clean up include files and file including. Split nonints.h into pieces 2005-02-01 10:50:37 +00:00
dir.c Make paths an explicite datatype instead of using the generic Lst. 2005-03-23 12:56:15 +00:00
dir.h Make paths an explicite datatype instead of using the generic Lst. 2005-03-23 12:56:15 +00:00
for.c Var_SubstOnly() is only used to subsitute a variable from the global 2005-05-10 12:02:15 +00:00
for.h Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
globals.h Implement "Remaking Makefiles" feature: 2007-03-08 09:16:11 +00:00
GNode.h Improve logging when -dm is specified: if the node is considered 2007-04-20 06:33:25 +00:00
hash_tables.c Add a .sinclude directive which does the exact same as .include, except 2005-09-26 20:31:00 +00:00
hash_tables.h Rename the directive_hash.[ch] files to hash_tables.[ch] now 2005-04-29 15:15:28 +00:00
hash.c Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
hash.h Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
job.c It seems some don't care for the anchient joke. Add WITHOUT_OLD_JOKE 2008-03-04 22:51:37 +00:00
job.h Implement "Remaking Makefiles" feature: 2007-03-08 09:16:11 +00:00
lst.c Get rid of the ReturnStatus obscuration that was anyway used only 2005-05-18 06:50:39 +00:00
lst.h Get rid of the ReturnStatus obscuration that was anyway used only 2005-05-18 06:50:39 +00:00
main.c Don't forget to set MAKEFLAGS in the childs' environment 2008-03-05 20:11:04 +00:00
make.1 Don't forget to set MAKEFLAGS in the childs' environment 2008-03-05 20:11:04 +00:00
make.c Improve logging when -dm is specified: if the node is considered 2007-04-20 06:33:25 +00:00
make.h Implement "Remaking Makefiles" feature: 2007-03-08 09:16:11 +00:00
Makefile No need to tell make to DTRT with "make love", just do it. 2008-03-04 22:32:58 +00:00
Makefile.dist Linux requires -D__dead2= and -D__unused= to get rid of the 2008-03-04 05:35:27 +00:00
parse.c In .error and .warning, prefer command-line variables 2007-04-12 18:14:00 +00:00
parse.h Move the Boolean and ReturnStatus stuff from sprite.h to util.h and 2005-05-13 08:53:00 +00:00
pathnames.h Remove leading underscores from the pathname defines. All identifiers 2005-03-11 13:02:38 +00:00
proc.c Factor out ProcExec() into its own file and rename it to Proc_Exec() for 2005-05-24 15:41:34 +00:00
proc.h Factor out ProcExec() into its own file and rename it to Proc_Exec() for 2005-05-24 15:41:34 +00:00
shell.c Factor out all the .SHELL parsing related stuff into its own file and 2005-05-24 15:30:03 +00:00
shell.h Factor out all the .SHELL parsing related stuff into its own file and 2005-05-24 15:30:03 +00:00
str.c Don't go beyond the provided string when parsing the `\' character. 2006-10-09 19:37:26 +00:00
str.h Make the ArgArray_Init() function visible to the rest of make. 2005-05-23 13:27:52 +00:00
suff.c Get rid of the third argument to Var_Value() the pointer it pointed 2005-05-24 15:58:35 +00:00
suff.h Make paths an explicite datatype instead of using the generic Lst. 2005-03-23 12:56:15 +00:00
targ.c Improve logging when -dm is specified: if the node is considered 2007-04-20 06:33:25 +00:00
targ.h Some more easy constification. 2005-02-04 07:51:00 +00:00
util.c Use the print_flags function to print the OP_ flags of a target. 2005-05-13 13:47:41 +00:00
util.h Get rid of the ReturnStatus obscuration that was anyway used only 2005-05-18 06:50:39 +00:00
var.c VarAdd() already does the debug printing, so Var_Set() only needs to do it 2006-07-17 21:05:27 +00:00
var.h The caller of Var_Value() should not change the variable value. Make 2005-05-24 16:05:51 +00:00