summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada2017-05-19 13:42:30 +0200
committerMasahiro Yamada2017-06-06 02:01:12 +0200
commit6f0fa58e459642b16901521cc58ac474b787ec5b (patch)
treec7310820bb5745c1eb9475500b64e921262c6c0b /Makefile
parentLinux 4.12-rc2 (diff)
downloadkernel-qcow2-linux-6f0fa58e459642b16901521cc58ac474b787ec5b.tar.gz
kernel-qcow2-linux-6f0fa58e459642b16901521cc58ac474b787ec5b.tar.xz
kernel-qcow2-linux-6f0fa58e459642b16901521cc58ac474b787ec5b.zip
kbuild: simplify silent build (-s) detection
This allows to detect -s (--silent) option without checking GNU Make version. As commit e36aaea28972 ("kbuild: Fix silent builds with make-4") pointed out, GNU Make 4.x changed the way/order it presents the command line options into MAKEFLAGS. In Make 3.8x, 's' is always the first in a group of short options. The group may be prefixed with '-' in some cases. In Make 4.x, 's' is always the last in a group of short options. As commit e6ac89fabd03 ("kbuild: Correctly deal with make options which contain an 's'") addressed, we also need to deal with long options that contain 's', like --warn-undefined-variables. Test cases: [1] command line input: make --silent -> MAKEFLAGS for Make 3.8x: s -> MAKEFLAGS for Make 4.x : s [2] command line input: make -srR -> MAKEFLAGS for Make 3.8x: sRr -> MAKEFLAGS for Make 4.x : rRs [3] command line input: make -s -rR --warn-undefined-variables -> MAKEFLAGS for Make 3.8x: --warn-undefined-variables -sRr -> MAKEFLAGS for Make 4.x : rRs --warn-undefined-variables My idea to cater to all the cases more easily is to filter out long options (--%), then search 's' with $(findstring ...). This way will be more future-proof even if future versions of Make put 's' in the middle of the group. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 1 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 63e10bd4f14a..57a013dc0364 100644
--- a/Makefile
+++ b/Makefile
@@ -84,17 +84,10 @@ endif
# If the user is running make -s (silent mode), suppress echoing of
# commands
-ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
-ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
+ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
quiet=silent_
tools_silent=s
endif
-else # make-3.8x
-ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
- quiet=silent_
- tools_silent=-s
-endif
-endif
export quiet Q KBUILD_VERBOSE