All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kbuild@vger.kernel.org
Subject: [RFC PATCH 2/3] kbuild: Add $(run-cmd) macro for running and maybe echoing command
Date: Thu, 12 Jul 2018 23:17:20 +0100	[thread overview]
Message-ID: <20180712221720.GJ14131@decadent.org.uk> (raw)
In-Reply-To: <20180712221619.GH14131@decadent.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]

$(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 <ben@decadent.org.uk>
---
 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;	                             \


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  parent reply	other threads:[~2018-07-12 22:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 22:16 [RFC PATCH 0/3] kbuild: In quiet mode, print the full command line if it fails Ben Hutchings
2018-07-12 22:17 ` [RFC PATCH 1/3] kbuild: Move final argument to modpost into $(cmd_modpost) Ben Hutchings
2018-07-12 22:17 ` Ben Hutchings [this message]
2018-07-12 22:17 ` [RFC PATCH 3/3] kbuild: In quiet mode, print the full command line if it fails Ben Hutchings
2018-07-18  5:26   ` Masahiro Yamada
2018-07-12 22:17 ` [RFC PATCH 1/3] kbuild: Move final argument to modpost into $(cmd_modpost) Ben Hutchings
2018-07-18  5:28   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180712221720.GJ14131@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=linux-kbuild@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.