From: Jiri Olsa Date: Sun, 8 Oct 2023 21:22:50 +0000 (+0200) Subject: tools/build: Fix -s detection code in tools/build/Makefile.build X-Git-Tag: v6.7-rc1~83^2~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9997f7ffb137447aa2f820c26cb1e6f5890d978;p=thirdparty%2Fkernel%2Flinux.git tools/build: Fix -s detection code in tools/build/Makefile.build 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 Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Acked-by: Namhyung Kim Cc: Peter Zijlstra Cc: KP Singh Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: Hao Luo Cc: Ian Rogers Cc: Stanislav Fomichev Cc: Daniel Borkmann Cc: Quentin Monnet Cc: Arnaldo Carvalho de Melo Cc: Andrii Nakryiko Cc: Alexei Starovoitov Cc: Ingo Molnar Cc: Alexander Shishkin Cc: bpf@vger.kernel.org Cc: linux-perf-users@vger.kernel.org Link: https://lore.kernel.org/r/20231008212251.236023-2-jolsa@kernel.org Signed-off-by: Namhyung Kim --- diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index fac42486a8cf0..5fb3fb3d97e0f 100644 --- a/tools/build/Makefile.build +++ b/tools/build/Makefile.build @@ -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