Re: [PATCH] kbuild: honor '-s' option for tools/*

From: Joe Perches
Date: Mon Oct 10 2016 - 09:33:12 EST


On Mon, 2016-10-10 at 14:36 +0200, Arnd Bergmann wrote:
> This changes all three of the above to behave just like Kbuild does,
> and print no output with 'make -s' regardless of the version of that
> tool, but otherwise behaves as before. In case of
> tools/scripts/Makefile.include, I decided to use an identical
> conditional block to set the $(quiet) variable for consistency,
> even though it is not used in the same way.

trivial notes:

> diff --git a/Makefile b/Makefile
[]
> @@ -1612,11 +1612,12 @@ image_name:
> # Clear a bunch of variables before executing the submake
> tools/: FORCE
> $(Q)mkdir -p $(objtree)/tools
> - $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
> + echo MAKEFLAGS=\""$(MAKEFLAGS)"\"
> + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(findstring s,$(firstword -$(MAKEFLAGS))) $(filter --j% -j -s,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/

Perhaps this is complicated enough to warrant some additional comments.

> diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
[]
> @@ -19,6 +19,16 @@ else
> Q=@
> endif
>
> +ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
> +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
> + quiet=silent_
> +endif
> +else # make-3.8x
> +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
> + quiet=silent_
> +endif
> +endif

And perhaps the tests should be reversed for make version 3 so when
make version 5 comes out and it likely has the same behavior as
version 4, this doesn't need rewrite.