Skip to contentSkip to conversation

tools/build: Fix -s detection code for new make

PATCH Superseded Jiri Olsa 3 participants 3 messages Oct 4, 2023 – Oct 6, 2023 BPF

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 tools/build: Fix -s detection code for new make

As Dmitry described in [1] changelog the current way of detecting -s option is broken for new make.

Changing the tools/build -s option detection the same way as it was fixed for root Makefile in [1].

[1] 4bf73588165b ("kbuild: Port silent mode detection to future gnu make.")

Cc Dmitry Goncharov <[email protected]>
---
 tools/build/Makefile.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/build/Makefile.build +9 -1
index fac42486a8cf..5fb3fb3d97e0 100644
@@ -20,7 +20,15 @@ else
   Q=@
 endif
 
-ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
+# If the user is running make -s (silent mode), suppress echoing of commands
+# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
+ifeq ($(filter 3.%,$(MAKE_VERSION)),)
+short-opts := $(firstword -$(MAKEFLAGS))
+else
+short-opts := $(filter-out --%,$(MAKEFLAGS))
+endif
+
+ifneq ($(findstring s,$(short-opts)),)
   quiet=silent_
 endif
 
Signature · 1 line
2.41.0
#1 lore raw
Quoted 10 lines · Jiri Olsa

As Dmitry described in [1] changelog the current way of detecting -s option is broken for new make.

Changing the tools/build -s option detection the same way as it was fixed for root Makefile in [1].

[1] 4bf73588165b ("kbuild: Port silent mode detection to future gnu make.")

Cc Dmitry Goncharov <[email protected]>

we actually need same change in tools/scripts/Makefile.include as well, I'll resend v2

jirka

Quoted 28 lines
---
 tools/build/Makefile.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/build/Makefile.build +9 -1
index fac42486a8cf..5fb3fb3d97e0 100644
@@ -20,7 +20,15 @@ else
   Q=@
 endif
 
-ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
+# If the user is running make -s (silent mode), suppress echoing of commands
+# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
+ifeq ($(filter 3.%,$(MAKE_VERSION)),)
+short-opts := $(firstword -$(MAKEFLAGS))
+else
+short-opts := $(filter-out --%,$(MAKEFLAGS))
+endif
+
+ifneq ($(findstring s,$(short-opts)),)
   quiet=silent_
 endif
 
Signature · 1 line
2.41.0
#2 lore raw

Em Fri, Oct 06, 2023 at 11:27:23PM +0200, Jiri Olsa escreveu:

Quoted 7 lines · Jiri Olsa
Quoted 6 lines

As Dmitry described in [1] changelog the current way of detecting -s option is broken for new make.

Changing the tools/build -s option detection the same way as it was fixed for root Makefile in [1].

Quoted 7 lines
Quoted 4 lines

[1] 4bf73588165b ("kbuild: Port silent mode detection to future gnu make.")

Cc Dmitry Goncharov <[email protected]>

we actually need same change in tools/scripts/Makefile.include as well, I'll resend v2

Thanks, I noticed the change in behaviour and was gegoing thru other grep/sed, egrep, NO_LIBTRACEEVENT, binutils not being installed leading to -1 error in annotation, etc before getting to this, on the way to judiciously test the new default to BUILD_BPF_SKEL=1.

I did a quick test and got a familiar output when building perf, please submit v2, v1 is great for me so far :)

- Arnaldo

Quoted 30 lines

jirka

Quoted 28 lines
---
 tools/build/Makefile.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/build/Makefile.build +9 -1
index fac42486a8cf..5fb3fb3d97e0 100644
@@ -20,7 +20,15 @@ else
   Q=@
 endif
 
-ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
+# If the user is running make -s (silent mode), suppress echoing of commands
+# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
+ifeq ($(filter 3.%,$(MAKE_VERSION)),)
+short-opts := $(firstword -$(MAKEFLAGS))
+else
+short-opts := $(filter-out --%,$(MAKEFLAGS))
+endif
+
+ifneq ($(findstring s,$(short-opts)),)
   quiet=silent_
 endif
 
Signature · 1 line
2.41.0
Signature · 1 line
- Arnaldo