Update of bug #58341 (project make): Summary: `make --debug` does not set 'd' in MAKEFLAGS => MAKEFLAGS in the makefile contains only simple options
_______________________________________________________ Follow-up Comment #1: I've retitled this issue because I've discovered that when examining the MAKEFLAGS variable from within the makefile, only the simple flags are available, like -k, -r, etc. None of the flags that take arguments are available. For example: echo '$(info MAKEFLAGS=$(MAKEFLAGS))' | make -f- -k -I/tmp Shows: MAKEFLAGS=k but no sign of the -I/tmp option. If you examine the value of MAKEFLAGS in the context of a recipe as it is passed to a sub-make, it contains all the content that you'd expect: echo 'all:;@echo MAKEFLAGS=$(MAKEFLAGS)' | make -f- -k -I/tmp MAKEFLAGS=k -I/tmp so it's only while the makefiles are being parsed that MAKEFLAGS is limited in this way. I examined the code and this appears to have always been the case, so it's not a recent regression. And I examined the GNU make manual and I can see no discussion of this behavior so it doesn't seem to be a documented "feature". I think this is a bug and that MAKEFLAGS when examined within the makefile should be equivalent to what will be used when invoking a sub-make. Unfortunately it's not a completely trivial problem to solve. We actually have to parse the MAKEFLAGS variable multiple times, in case the user's makefile modifies this value. If we just do the simple thing and add the flags into MAKEFLAGS then we end up getting multiple copies of options which are additive like -I. So before we can make this change we need to have a way to clear out the previous information about these values else we'll get multiple copies of additive flags. In general the behavior of setting MAKEFLAGS in the makefile is fraught and complex but it's something people definitely expect to be able to do. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?58341> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/