The first word in $(MAKEFLAGS) is not a group of short options.
The manual says as follows:
"Recall that MAKEFLAGS will put all single-letter options (such as ‘-t’)
into the first word, and that word will be empty if no single-letter
options were given. To work with this, it’s helpful to add a value at
the start to ensure there’s a word: for example ‘-$(MAKEFLAGS)’."
This is no longer true when MAKEFLAGS is set
via the command line.
[test code]
ifeq ($(SUBMAKE),)
all:
$(MAKE) MAKEFLAGS=--no-print-directory SUBMAKE=1
else
all:
@echo in submake: MAKEFLAGS=$(MAKEFLAGS)
@echo in submake: short-opts=$(firstword -$(MAKEFLAGS))
endif
[result]
make MAKEFLAGS=--no-print-directory SUBMAKE=1
make[1]: Entering directory '/tmp'
in submake: MAKEFLAGS=--no-print-directory
in submake: short-opts=---no-print-directory
make[1]: Leaving directory '/tmp'
So, $(firstword -$(MAKEFLAGS)) cannot retrieve short options.
Is this a bug?
--
Best Regards
Masahiro Yamada