Negating --no-print-directory

Masahiro Yamada <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CAK7LNATNVnxduJTmn2yZLH+4OkcftRKw49kPS4hxdHEJveT=fg@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.