diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-11-30 09:23:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-01 07:24:12 +0900 |
commit | 67b36879fc06581131fa7e57c9ee1e560ea9d1fc (patch) | |
tree | aed43e48d11f215f2bbc2f11cab647f6581a575b /shared.mak | |
parent | 9f95c7aefa8419b697972abd9d25ce9062fac2bf (diff) | |
download | git-67b36879fc06581131fa7e57c9ee1e560ea9d1fc.tar.gz |
Makefiles: change search through $(MAKEFLAGS) for GNU make 4.4
Since GNU make 4.4 the semantics of the $(MAKEFLAGS) variable has
changed in a backward-incompatible way, as its "NEWS" file notes:
Previously only simple (one-letter) options were added to the MAKEFLAGS
variable that was visible while parsing makefiles. Now, all options are
available in MAKEFLAGS. If you want to check MAKEFLAGS for a one-letter
option, expanding "$(firstword -$(MAKEFLAGS))" is a reliable way to return
the set of one-letter options which can be examined via findstring, etc.
This upstream change meant that e.g.:
make man
Would become very noisy, because in shared.mak we rely on extracting
"s" from the $(MAKEFLAGS), which now contains long options like
"--jobserver-auth=fifo:<path>", which we'll conflate with the "-s"
option.
So, let's change this idiom we've been carrying since [1], [2] and [3]
as the "NEWS" suggests.
Note that the "-" in "-$(MAKEFLAGS)" is critical here, as the variable
will always contain leading whitespace if there are no short options,
but long options are present. Without it e.g. "make --debug=all" would
yield "--debug=all" as the first word, but with it we'll get "-" as
intended. Then "-s" for "-s", "-Bs" for "-s -B" etc.
1. 0c3b4aac8ec (git-gui: Support of "make -s" in: do not output
anything of the build itself, 2007-03-07)
2. b777434383b (Support of "make -s": do not output anything of the
build itself, 2007-03-07)
3. bb2300976ba (Documentation/Makefile: make most operations "quiet",
2009-03-27)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'shared.mak')
-rw-r--r-- | shared.mak | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shared.mak b/shared.mak index 33f43edbf9..57e67f5c9a 100644 --- a/shared.mak +++ b/shared.mak @@ -37,13 +37,13 @@ space := $(empty) $(empty) QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir QUIET_SUBDIR1 = -ifneq ($(findstring w,$(MAKEFLAGS)),w) +ifneq ($(findstring w,$(firstword -$(MAKEFLAGS))),w) PRINT_DIR = --no-print-directory else # "make -w" NO_SUBDIR = : endif -ifneq ($(findstring s,$(MAKEFLAGS)),s) +ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),s) ifndef V ## common QUIET_SUBDIR0 = +@subdir= |