Hi. When --no-print-directory is set in MAKEFLAGS, what is the best way to negate it?
One solution is to filter it out from MAKEFLAGS. IMHO, it would be simpler to be able to negate --no-print-directory by passing -w (--print-directory). [Working solution] ifeq ($(SUBMAKE),) MAKEFLAGS += --no-print-directory MAKEFLAGS += -rR all: @echo in top: MAKEFLAGS=$(MAKEFLAGS) MAKEFLAGS="$(filter-out --no-print-directory, $(MAKEFLAGS))" $(MAKE) SUBMAKE=1 else all: @echo in submake: MAKEFLAGS=$(MAKEFLAGS) endif $ make in top: MAKEFLAGS=rR --no-print-directory MAKEFLAGS="rR" make SUBMAKE=1 make[1]: Entering directory '/tmp' in submake: MAKEFLAGS=rRw -- SUBMAKE=1 make[1]: Leaving directory '/tmp' [Not working (but I hoped it would work)] ifeq ($(SUBMAKE),) MAKEFLAGS += --no-print-directory MAKEFLAGS += -rR all: @echo in top: MAKEFLAGS=$(MAKEFLAGS) $(MAKE) -w SUBMAKE=1 else all: @echo in submake: MAKEFLAGS=$(MAKEFLAGS) endif $ make in top: MAKEFLAGS=rR --no-print-directory --print-directory make SUBMAKE=1 in submake: MAKEFLAGS=rR --no-print-directory -- SUBMAKE=1 The second case does not work, but does it make sense to support it? Currently, --no-print-directory always takes precedence over --print-directory. One question pops up: in which case is the -w option useful? -w is an implicit default. Once --no-print-directory is given, --no-print-directory always wins. Passing -w later has no effect. -- Best Regards Masahiro Yamada