Skip to contentSkip to conversation

Makefile: improve detection of make "-s" flag

PATCH New Fabio Porcedda 2 participants 4 messages Oct 27, 2014 – Oct 29, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: improve detection of make "-s" flag

Because it's just checked the presence of the "s" character even a
make --warn-undefined-variables
is detected as a silent build so fix this by filtering out long options.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 907a0fc..4fd6b64 100644
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 TARGETS :=
 
 # silent mode requested?
-QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q)
+QUIET := $(if $(findstring s, $(filter-out --%, $(MAKEFLAGS))), -q)
 
 # Strip off the annoying quoting
 ARCH := $(call qstrip,$(BR2_ARCH))
Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/1 Makefile: improve detection of make "-s" flag

Quoted 12 lines · Fabio Porcedda

Because it's just checked the presence of the "s" character even a
make --warn-undefined-variables
is detected as a silent build so fix this by filtering out long options.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 907a0fc..4fd6b64 100644

Makefile GNU_HOST_NAME := $(shell support/gnuconfig/config.guess) · line 306

Quoted 5 lines
Makefile +1 -1
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 TARGETS :=
 
 # silent mode requested?
-QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q)
+QUIET := $(if $(findstring s, $(filter-out --%, $(MAKEFLAGS))), -q)

This add a spurious space to the QUIET variable. Not really important, but we
normally avoid that.

Also, maybe an easier solution is:

# Search for s only in the short options
QUIET := $(if $(findstring s,$(firstword $(MAKEFLAGS))),-q)

(Note that GNU make converts something like --silent into an s in MAKEFLAGS, and that all the short options are collected to the beginning of MAKEFLAGS.)

Regards,
Arnout

Quoted 4 lines
Makefile +0 -0
 # Strip off the annoying quoting
 ARCH := $(call qstrip,$(BR2_ARCH))
 
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 Makefile: improve detection of make "-s" flag

Hi Arnout,
thanks for reviewing it.

Quoted 15 lines · Arnout Vandecappelle
Quoted 14 lines · Fabio Porcedda

Because it's just checked the presence of the "s" character even a
make --warn-undefined-variables
is detected as a silent build so fix this by filtering out long options.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 907a0fc..4fd6b64 100644
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 TARGETS :=
 
Quoted 6 lines

Makefile GNU_HOST_NAME := $(shell support/gnuconfig/config.guess) · line 306

Quoted 3 lines
Makefile +1 -1
 # silent mode requested?
-QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q)
+QUIET := $(if $(findstring s, $(filter-out --%, $(MAKEFLAGS))), -q)

This add a spurious space to the QUIET variable. Not really important, but we
normally avoid that.

Ok, I will fix it.

Quoted 4 lines

Also, maybe an easier solution is:

# Search for s only in the short options
QUIET := $(if $(findstring s,$(firstword $(MAKEFLAGS))),-q)

I tried it but it does not work because with "make --warn-undefined-variables" the MAKEFLAGS variable contains just the single word "--warn-undefined-variables" so it triggers a false positive.

Quoted 2 lines

(Note that GNU make converts something like --silent into an s in MAKEFLAGS, and that all the short options are collected to the beginning of MAKEFLAGS.)

Thanks & BR

Signature · 1 line
Fabio Porcedda