From patchwork Thu Jul 12 22:17:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 10522369 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 5C0DE6032C for ; Thu, 12 Jul 2018 22:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4884D29A3A for ; Thu, 12 Jul 2018 22:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A2B129AC0; Thu, 12 Jul 2018 22:17:22 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI 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 DD03829A3A for ; Thu, 12 Jul 2018 22:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732588AbeGLW24 (ORCPT ); Thu, 12 Jul 2018 18:28:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:38057 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732298AbeGLW2z (ORCPT ); Thu, 12 Jul 2018 18:28:55 -0400 Received: from ben by shadbolt.decadent.org.uk with local (Exim 4.84_2) (envelope-from ) id 1fdjto-0007jf-7G for linux-kbuild@vger.kernel.org; Thu, 12 Jul 2018 23:17:20 +0100 Date: Thu, 12 Jul 2018 23:17:20 +0100 From: Ben Hutchings To: linux-kbuild@vger.kernel.org Message-ID: <20180712221720.GJ14131@decadent.org.uk> References: <20180712221619.GH14131@decadent.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180712221619.GH14131@decadent.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ben@decadent.org.uk Subject: [RFC PATCH 2/3] kbuild: Add $(run-cmd) macro for running and maybe echoing command X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on shadbolt.decadent.org.uk) 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 $(run-cmd) replaces a sequence of two macros that is used several times in Kbuild.include. This should be a no-op change, but the following commit will change the definition to be more complex. Signed-off-by: Ben Hutchings --- scripts/Kbuild.include | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index c8156d61678c..8778ae4a3476 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -224,8 +224,10 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) echo-cmd = $(if $($(quiet)cmd_$(1)),\ echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) +run-cmd = $(echo-cmd) $(cmd_$(1)) + # printing commands -cmd = @$(echo-cmd) $(cmd_$(1)) +cmd = @$(run-cmd) # Add $(obj)/ for paths that are not absolute objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) @@ -262,7 +264,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ + $(run-cmd); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. @@ -273,7 +275,7 @@ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ ifndef CONFIG_TRIM_UNUSED_KSYMS cmd_and_fixdep = \ - $(echo-cmd) $(cmd_$(1)); \ + $(run-cmd); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd; @@ -296,7 +298,7 @@ ksym_dep_filter = \ esac | tr ";" "\n" | sed -n 's/^.*=== __KSYM_\(.*\) ===.*$$/_\1/p' cmd_and_fixdep = \ - $(echo-cmd) $(cmd_$(1)); \ + $(run-cmd); \ $(ksym_dep_filter) | \ scripts/basic/fixdep -e $(depfile) $@ '$(make-cmd)' \ > $(dot-target).tmp; \