The first word in $(MAKEFLAGS) is not a group of short options

Masahiro Yamada <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CAK7LNATjo1T75=QbUd5cNwmkdNhwcKyi8Tt6WZHtbOo-WR9Wkg@mail.gmail.com>
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
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.