From patchwork Fri May 19 07:09:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 100157 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp183146qge; Fri, 19 May 2017 00:10:58 -0700 (PDT) X-Received: by 10.99.116.82 with SMTP id e18mr8487927pgn.1.1495177858691; Fri, 19 May 2017 00:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495177858; cv=none; d=google.com; s=arc-20160816; b=ApBHzMrY3YdZH9I8dxLHHp4T235kqVYkrIlrVStzV+aQwdvjm7YooDN/aFFAXj2Vod bnDUl5D2Vth1xA05X5tetgeDA3cmbaiZ8XYYpaOiF60TEYM8SXcpWYeKtvkxD/x7Ynfu PEWhPXTswUaBTx0hJxinuEUUyAVUb0zXhlOKVjmb/IpRti4pFpHziH3NCV2vgaL4qk9j UmgpcskMO+37rDaTcQe3dbMfWGefDE5pAX94/iwMdbwVLVXWaXtMXKKRgs7HNC/usVDY B2TTUYhzhfF0hYYnl01fW7KFTecrNE2ZXfpC+JdmQaO7VjeIamnORovGh06Up5Njr1ko RzXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=CCJ4PKwv3xqa6YDRVIdWMqLVekhBvcUwIRE2kZVKjnA=; b=CFXGwYdxywomvKZGCp1sFCuzrZnXHuVkcbSMR3KT4P7eQutJ7okFFg45BTt8Bujrdl /0zK7+jufzE3ckULCOt/AfBlKpqhKH1jUqk/XdbHbacN5DarY5GJIk5lmwPQm0+Ln1WR T0j4eP3W4H/fzdCPu0DgF/8b59yhabsHMyv7Dl1PExRyU9ueWqDZjXxYroIuyOf2FN5C wLxrwgbeaUnm60HkMFJW9DeOtRI3BYYwU/8y2PMUYeKwIOHUYdQdc3xIAYmwivKqMLi0 HFekApmz3NXr2jkd2Fw66gdjmcWiVjpEanN2whlcc4QGQ/d0p/ocVXodWaRS9cH/gMOX X9Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i196si7440212pgc.144.2017.05.19.00.10.58; Fri, 19 May 2017 00:10:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753364AbdESHKD (ORCPT + 25 others); Fri, 19 May 2017 03:10:03 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:21437 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752058AbdESHKA (ORCPT ); Fri, 19 May 2017 03:10:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v4J79aJ0020764; Fri, 19 May 2017 16:09:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v4J79aJ0020764 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495177777; bh=CCJ4PKwv3xqa6YDRVIdWMqLVekhBvcUwIRE2kZVKjnA=; h=From:To:Cc:Subject:Date:From; b=VWNt+GdbS181KnM2+F/tXIFmo3UBYK3BdAT268c+nqUHo9Qgbh9xamNRc3tT+BRDT TekEbwxt/+swtCCnT9N5NYMlPN/K/ZlojtG8APsXVlMMRdR86jb7wgnAtDyUOBRuSI 2o3ABs8O3Jn7vKpXJcMQM2LogMXtCjX1LUY3Vb1f6l0rL2yBL6vWoZGMnk+4jnBG3C kq/LssQTdAyX8S2EeocmUJ1iL9aEVN+3zZwGw8uJTrdFgI7MCpSzgbYEcHDvNTpyf/ hzPg+ugKLKEfZT7FAL8vzPABCLbWXNRIQTDAVMBCnnPH8GJAeGhf4P6Ybdn2YstRrC aJh/H3nyHTmdg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org, Wang Nan , Josh Poimboeuf , Arnaldo Carvalho de Melo , Jiri Olsa Subject: [PATCH v2] kbuild: simplify silent build (-s) detection Date: Fri, 19 May 2017 16:09:08 +0900 Message-Id: <1495177748-24037-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 be the first in a group of short options. The group could be prefixed with '-'. 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 end with '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 We can take care of them, by filtering out long options (--%), then matching -s% s% %s patterns. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix makefiles under tools as well Makefile | 9 +-------- tools/build/Makefile.build | 8 +------- tools/scripts/Makefile.include | 8 +------- 3 files changed, 3 insertions(+), 22 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index b1ee4a49efa2..d8b5c4230da0 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 ($(filter -s% s% %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 diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index e279a71c650d..850fe9ce47d3 100644 --- a/tools/build/Makefile.build +++ b/tools/build/Makefile.build @@ -19,15 +19,9 @@ else Q=@ endif -ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 -ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) +ifneq ($(filter -s% s% %s,$(filter-out --%,$(MAKEFLAGS))),) quiet=silent_ endif -else # make-3.8x -ifneq ($(filter s% -s%,$(MAKEFLAGS)),) - quiet=silent_ -endif -endif build-dir := $(srctree)/tools/build diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index fc74db62fef4..7fda39adf3cc 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -58,15 +58,9 @@ else NO_SUBDIR = : endif -ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4 -ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),) +ifneq ($(filter -s% s% %s,$(filter-out --%,$(MAKEFLAGS))),) silent=1 endif -else # make-3.8x -ifneq ($(filter s% -s%,$(MAKEFLAGS)),) - silent=1 -endif -endif # # Define a callable command for descending to a new directory