From patchwork Fri May 19 04:28:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 100156 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp141545qge; Thu, 18 May 2017 21:28:57 -0700 (PDT) X-Received: by 10.98.197.133 with SMTP id j127mr8269715pfg.239.1495168137338; Thu, 18 May 2017 21:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495168137; cv=none; d=google.com; s=arc-20160816; b=IcO0FpJW1cwTK/d1h78C4fzfaGu8ZTD9Sk5lh5l/bA8xmZlefE/knssX90l60zayli atlyrLsiqq/wbXu6rMullf1xhxuikjgFppIgs7cxEJc4tH71apeqeWcl4jz3pIF/Kwdh 07xLp9wOUzqn7FKJC5cdT+mD3ejHHSx5oLJibsfSvZlW/mSlNTCm778csofmC7PkT2ZW vRMYKGJQs+o8ffj/ElhmrI7qKm9URe9jogVo71qquomJlJVQ6P3Nc9DyHnfEUFjfLVFt LAy3FaoI3iDQaFaPD+SHDGKxW+9yPe7N2IT1GZ3eX3lkGQmZ1CFmbWDzAi6bckOvn1HU 9G/Q== 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=Cwql8eykxLpD/0A8KzulUNph3whTp62A8/bsN+gp3IM=; b=O8gpJEfQFlveOBLJ7ZlPOWUj78TVezjBlkyShflBUZFGEYItbJrT1ACgFh1LfWKl4C MggWqpAc8CJ98foi4pYMrA2726CFTEnU8oobMdSpVk8cF2UJsyxy7ImFTPYe+msI9Osd 32xQT4MmksApGxZsiKuHwOg+wsS60cUjxRgCh+hUS94wynewZsTCa54+b/qc2TXP/g1N lgdE+OaczWA5sCbKkQ7MyJaF1b4SGpVGpQsJwD7oatWpUyMMXijDnL2ce5Lw1PZ0Rd9M NjXMu5a10sgchmDhN3nbXUOkmqU0vJMXSRP5gyix3djBzOYkaWQfePkrO3nY1SziEYGO G53w== 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 k68si7232435pfk.369.2017.05.18.21.28.56; Thu, 18 May 2017 21:28:57 -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 S1755841AbdESE2k (ORCPT + 25 others); Fri, 19 May 2017 00:28:40 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38336 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755589AbdESE2b (ORCPT ); Fri, 19 May 2017 00:28:31 -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 v4J4SJ9n025971; Fri, 19 May 2017 13:28:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v4J4SJ9n025971 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495168099; bh=Cwql8eykxLpD/0A8KzulUNph3whTp62A8/bsN+gp3IM=; h=From:To:Cc:Subject:Date:From; b=PFHxhO+YmxnVaQ9vAUkdr0ukxBfe5E89bbXwENqt3ud8esZlR7e3d/Arsr4YfbzY9 Va5bPNA/FK7mILMCBXHszodRaRWX07pIIvizlZJyRKJ0jN17ysF/+xsoGe9qdBx+74 bndFd4UF7LRjBMLTyArSPA4TY49J92kCSufteBC4USyC+LQgAU7V9ooU+Ck+7ZTg6U xeQV6WBEtDUzrbxqKB7dayBh1NXcUXpISZtPF5+85GLrbwLVvgLl1jXuI7mo/iYeiz 9s/prY8mqSXWRtbOUmh2lOfA+ElE2Cs+mGnNqJRLk1cEqQJ4D1FlhS6tPlXPHIsJ/2 EHi6g0jR+IF7Q== 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 Subject: [PATCH] kbuild: simplify silent build (-s) detection Date: Fri, 19 May 2017 13:28:16 +0900 Message-Id: <1495168096-22440-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 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 --- Makefile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index b1ee4a4..d8b5c42 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