From patchwork Mon Oct 10 12:36:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9369449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1320D60487 for ; Mon, 10 Oct 2016 12:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0375F29935 for ; Mon, 10 Oct 2016 12:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBA062996F; Mon, 10 Oct 2016 12:45:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57FEA29935 for ; Mon, 10 Oct 2016 12:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752480AbcJJMp1 (ORCPT ); Mon, 10 Oct 2016 08:45:27 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:57031 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbcJJMpO (ORCPT ); Mon, 10 Oct 2016 08:45:14 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MGVBU-1bgQgM2z5M-00DDmi; Mon, 10 Oct 2016 14:38:18 +0200 From: Arnd Bergmann To: Michal Marek Cc: Josh Poimboeuf , Arnd Bergmann , Arnaldo Carvalho de Melo , Masahiro Yamada , Jiri Olsa , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: honor '-s' option for tools/* Date: Mon, 10 Oct 2016 14:36:37 +0200 Message-Id: <20161010123812.1425903-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Bz1IXvZ814ZFHMKRQpgJXslN/eoeNeLqs1ErcGsb6h/sToI4Ha7 EXfyjWytJpGcXJ0FOGJhHLYwb1Kckoi1fFswG+8lE6p4VBdklXF2MVG7w3pNudt1iM05Qts 7+M6QpMsmsAhXMUczDjp/ROTRdO0ykjf6/KTArmWYvrnqguSGd3x9D7qw0R130tYTxaUXX3 0eeEAl3DWMglGQIC61O9g== X-UI-Out-Filterresults: notjunk:1; V01:K0:IX8ZaIinZz0=:1YeILgyvM3ZkSUty4vx5SA QmlgYiE0pUxjtj0jAZ4xY/DVqk6Y9BZrIFZoAp2cOxhBi86PyNU/Bh3nmLQQZzo3Fnb0vkF1a KN/rd6YO68b3HCuRbiIedHBOWIB/4dLlZFEO6eKSdCiA7zrTt9sFLlrF9W659Qo+Dl3n2Z/ZU qHyDeMbjK6APywXecajHkw9vEcq8dC1A87tv2pHmpk/HNjj54iWFyWif0aLKrq6myQ6P5K1IE s75l/x/TSnl4p5MaJdrJTLvZ2/F/kWUXWAmKTZBlFatuFaiPzYAsMLJ9Aon513gItuEQ4WDRF reQ96PbPHrJVd6Tv1OcNhI2sCulLqxX9UbjB25WTeVYRaOZz9Re+R+82AcoJJNwtadIQasbho adUXS6gQk1JniQSwyhEuP4oGh8UY4BskxZ3HiY/NHfpV+ohhS4kf9NhaNWMaqpLt+27kU60MQ ytT9PXypDI+m8cfjm/FS8+7g7sccag5sDV7pJLYF8GsccnVdEifhQUM9HWe0MJ76St/Ewifwl 20bRhzIQE2s7UOudT+EztKmOowWW5xTRQLXMuRpz/ADk2lgVhLXeYuMGRIVqrke22LYyIh36N gFaZGjpyUFMnWQ+UbK6Bgka3gYK0b+E3jgPFbH2rkEAEQRoBndRZvaC0lX7esYSFnoaADL8kv eb7jxsJrgedaUab8673GLz2ZLzria19qG9KQqeaSf9p0uqfTdcxUMmMfhOBxrL8Pw6cc= Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When building with 'make -s' on x86, we always see the output for descending into the tools/objtool directory when CONFIG_STACK_VALIDATION is set, but we should not see any output. There are three related problems causing this: * we override the MAKEFLAGS variable when entering tools, keeping only the -j and --j% options around when we should also propagate the -s flag (for some make versions) as well as the 's' character in the first word of the variable. * The build system in tools/build/Makefile.build that is used for some parts of the build process of objtool implements the same logic as the normal kbuild, using 'quiet_$(cmd)' to indicate the string that should be printed, but lacks the logic to skip that when building with 'make -s'. * The /other/ build system in tools/scripts/Makefile.include that is also used for building objtool checks for the 's' flag in the beginning of the first word of Makeflags, which works for GNU make 3.x, but not for GNU make 4.x, which has it in the end of that word. 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. Signed-off-by: Arnd Bergmann --- Makefile | 5 +++-- tools/build/Makefile.build | 10 ++++++++++ tools/scripts/Makefile.include | 12 +++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d5289117360b..3638bb27ba2c 100644 --- 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/ 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/ $* + $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(findstring s,$(firstword -$(MAKEFLAGS))) $(filter --j% -j -s,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $* # Single targets # --------------------------------------------------------------------------- diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index 99c0ccd2f176..e279a71c650d 100644 --- 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 + build-dir := $(srctree)/tools/build # Define $(fixdep) for dep-cmd function diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 8abbef164b4e..aa6c3c9261e4 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -58,7 +58,17 @@ descend = \ QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir QUIET_SUBDIR1 = -ifneq ($(findstring $(MAKEFLAGS),s),s) +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 + +ifneq ($(quiet),silent_) ifneq ($(V),1) QUIET_CC = @echo ' CC '$@; QUIET_CC_FPIC = @echo ' CC FPIC '$@;