Skip to content

Commit 4bf7358

Browse files
gtkillermasahir0y
authored andcommitted
kbuild: Port silent mode detection to future gnu make.
Port silent mode detection to the future (post make-4.4) versions of gnu make. Makefile contains the following piece of make code to detect if option -s is specified on the command line. ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) This code is executed by make at parse time and assumes that MAKEFLAGS does not contain command line variable definitions. Currently if the user defines a=s on the command line, then at build only time MAKEFLAGS contains " -- a=s". However, starting with commit dc2d963989b96161472b2cd38cef5d1f4851ea34 MAKEFLAGS contains command line definitions at both parse time and build time. This '-s' detection code then confuses a command line variable definition which contains letter 's' with option -s. $ # old make $ make net/wireless/ocb.o a=s CALL scripts/checksyscalls.sh DESCEND objtool $ # this a new make which defines makeflags at parse time $ ~/src/gmake/make/l64/make net/wireless/ocb.o a=s $ We can see here that the letter 's' from 'a=s' was confused with -s. This patch checks for presence of -s using a method recommended by the make manual here https://www.gnu.org/software/make/manual/make.html#Testing-Flags. Link: https://lists.gnu.org/archive/html/bug-make/2022-11/msg00190.html Reported-by: Jan Palus <[email protected]> Signed-off-by: Dmitry Goncharov <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 9edb4fd commit 4bf7358

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@ endif
9393

9494
# If the user is running make -s (silent mode), suppress echoing of
9595
# commands
96+
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
9697

97-
ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
98-
quiet=silent_
99-
KBUILD_VERBOSE = 0
98+
ifeq ($(filter 3.%,$(MAKE_VERSION)),)
99+
silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
100+
else
101+
silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
102+
endif
103+
104+
ifeq ($(silence),s)
105+
quiet=silent_
106+
KBUILD_VERBOSE = 0
100107
endif
101108

102109
export quiet Q KBUILD_VERBOSE

0 commit comments

Comments
 (0)