]> git.pld-linux.org Git - packages/kernel.git/blob - make-4.4.patch
46ae0e30a5f660e12b1628689d61ca0ac788c7fc
[packages/kernel.git] / make-4.4.patch
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.
5
6 Port silent mode detection to the future (post make-4.4) versions of gnu make.
7
8 Makefile contains the following piece of make code to detect if option -s is
9 specified on the command line.
10
11 ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
12
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
19 build time.
20
21 This '-s' detection code then confuses a command line variable
22 definition which contains letter 's' with option -s.
23
24 $ # old make
25 $ make net/wireless/ocb.o a=s
26   CALL    scripts/checksyscalls.sh
27   DESCEND objtool
28 $ # this a new make which defines makeflags at parse time
29 $ ~/src/gmake/make/l64/make net/wireless/ocb.o a=s
30 $
31
32 We can see here that the letter 's' from 'a=s' was confused with -s.
33
34 This patch checks for presence of -s using a method recommended by the
35 make manual here
36 https://www.gnu.org/software/make/manual/make.html#Testing-Flags.
37
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>
42 ---
43  Makefile | 13 ++++++++++---
44  1 file changed, 10 insertions(+), 3 deletions(-)
45
46 diff --git a/Makefile b/Makefile
47 index 797fafbc1b45c..53fa1a9fba8aa 100644
48 --- a/Makefile
49 +++ b/Makefile
50 @@ -93,10 +93,17 @@ endif
51  
52  # If the user is running make -s (silent mode), suppress echoing of
53  # commands
54 +# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
55  
56 -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
57 -  quiet=silent_
58 -  KBUILD_VERBOSE = 0
59 +ifeq ($(filter 3.%,$(MAKE_VERSION)),)
60 +silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
61 +else
62 +silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
63 +endif
64 +
65 +ifeq ($(silence),s)
66 +quiet=silent_
67 +KBUILD_VERBOSE = 0
68  endif
69  
70  export quiet Q KBUILD_VERBOSE
71 -- 
72 cgit 
73
This page took 0.024768 seconds and 2 git commands to generate.