linux/tools/build
Masahiro Yamada 6f0fa58e45 kbuild: simplify silent build (-s) detection
This allows to detect -s (--silent) option without checking GNU Make
version.

As commit e36aaea289 ("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 e6ac89fabd ("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>
2017-06-06 09:01:12 +09:00
..
Documentation tools build: Add CFLAGS_REMOVE_* support 2016-11-14 11:37:25 -03:00
feature Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-05-15 15:50:49 -07:00
tests tools build: Build fixdep helper from perf and basic libs 2015-09-28 15:50:55 -03:00
.gitignore perf build: Add fixdep to .gitignore 2015-10-20 10:43:28 -03:00
Build tools build: Make fixdep a hostprog 2016-10-03 11:40:35 -03:00
Build.include tools build: Move tabs to spaces where suitable 2016-12-05 16:06:03 -03:00
Makefile perf build: Add special fixdep cleaning rule 2017-02-17 16:04:38 -03:00
Makefile.build kbuild: simplify silent build (-s) detection 2017-06-06 09:01:12 +09:00
Makefile.feature tools build: Add test for sched_getcpu() 2017-03-03 19:07:19 -03:00
Makefile.include perf build: Add special fixdep cleaning rule 2017-02-17 16:04:38 -03:00
fixdep.c tools build: Make fixdep parsing wait for last target 2016-12-05 15:51:42 -03:00