1 From 22c65447a7a4667b91ce82a027c91005df136768 Mon Sep 17 00:00:00 2001
2 From: Dmitry Goncharov <dgoncharov@users.sf.net>
3 Date: Mon, 5 Dec 2022 16:48:19 -0500
4 Subject: kbuild: Port silent mode detection to future gnu make.
6 Port silent mode detection to the future (post make-4.4) versions of gnu make.
8 Makefile contains the following piece of make code to detect if option -s is
9 specified on the command line.
11 ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
13 This code is executed by make at parse time and assumes that MAKEFLAGS
14 does not contain command line variable definitions.
15 Currently if the user defines a=s on the command line, then at build only
16 time MAKEFLAGS contains " -- a=s".
17 However, starting with commit dc2d963989b96161472b2cd38cef5d1f4851ea34
18 MAKEFLAGS contains command line definitions at both parse time and
21 This '-s' detection code then confuses a command line variable
22 definition which contains letter 's' with option -s.
25 $ make net/wireless/ocb.o a=s
26 CALL scripts/checksyscalls.sh
28 $ # this a new make which defines makeflags at parse time
29 $ ~/src/gmake/make/l64/make net/wireless/ocb.o a=s
32 We can see here that the letter 's' from 'a=s' was confused with -s.
34 This patch checks for presence of -s using a method recommended by the
36 https://www.gnu.org/software/make/manual/make.html#Testing-Flags.
38 Link: https://lists.gnu.org/archive/html/bug-make/2022-11/msg00190.html
39 Reported-by: Jan Palus <jpalus+gnu@fastmail.com>
40 Signed-off-by: Dmitry Goncharov <dgoncharov@users.sf.net>
41 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
43 Makefile | 13 ++++++++++---
44 1 file changed, 10 insertions(+), 3 deletions(-)
46 diff --git a/Makefile b/Makefile
47 index 797fafbc1b45c..53fa1a9fba8aa 100644
50 @@ -93,10 +93,17 @@ endif
52 # If the user is running make -s (silent mode), suppress echoing of
54 +# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
56 -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
59 +ifeq ($(filter 3.%,$(MAKE_VERSION)),)
60 +silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
62 +silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
70 export quiet Q KBUILD_VERBOSE