All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Michal Marek <mmarek@suse.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 4/8] kbuild: de-duplicate fixdep usage
Date: Fri,  4 Mar 2016 00:40:46 -0500	[thread overview]
Message-ID: <1457070050-1564-5-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1457070050-1564-1-git-send-email-nicolas.pitre@linaro.org>

The generation and postprocessing of automatic dependency rules is
duplicated in rule_cc_o_c and if_changed_dep. Since this is not a
trivial one-liner action, it is now abstracted under cmd_and_fixdep
to simplify things and make future changes easier.

In the rule_cc_o_c case that means the order of some commands has been
altered, namely fixdep and related file manipulations are executed
earlier, but they didn't depend on those commands that now execute later.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
 scripts/Kbuild.include | 5 ++++-
 scripts/Makefile.build | 9 ++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 1db6d73c8d..8a257fa663 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -256,10 +256,13 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)),                       \
 # Execute the command and also postprocess generated .d dependencies file.
 if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ),                  \
 	@set -e;                                                             \
+	$(cmd_and_fixdep))
+
+cmd_and_fixdep =                                                             \
 	$(echo-cmd) $(cmd_$(1));                                             \
 	scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
 	rm -f $(depfile);                                                    \
-	mv -f $(dot-target).tmp $(dot-target).cmd)
+	mv -f $(dot-target).tmp $(dot-target).cmd;
 
 # Usage: $(call if_changed_rule,foo)
 # Will check if $(cmd_foo) or any of the prerequisites changed,
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index f4b4320e0d..8134ee81ad 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -243,14 +243,9 @@ endif
 
 define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
-	$(call echo-cmd,cc_o_c) $(cmd_cc_o_c);				  \
+	$(call cmd_and_fixdep,cc_o_c)					  \
 	$(cmd_modversions)						  \
-	$(call echo-cmd,record_mcount)					  \
-	$(cmd_record_mcount)						  \
-	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
-	                                              $(dot-target).tmp;  \
-	rm -f $(depfile);						  \
-	mv -f $(dot-target).tmp $(dot-target).cmd
+	$(call echo-cmd,record_mcount) $(cmd_record_mcount)
 endef
 
 # List module undefined symbols (or empty line if not enabled)
-- 
2.5.0

  parent reply	other threads:[~2016-03-04  5:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  5:40 [PATCH v5 0/8] Trim unused exported kernel symbols Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 1/8] kbuild: record needed exported symbols for modules Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 2/8] allow for per-symbol configurable EXPORT_SYMBOL() Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 3/8] fixdep: accept extra dependencies on stdin Nicolas Pitre
2016-03-04  5:40 ` Nicolas Pitre [this message]
2016-03-04  5:40 ` [PATCH v5 5/8] kbuild: add fine grained build dependencies for exported symbols Nicolas Pitre
2016-03-04 22:51   ` Michal Marek
2016-03-04 22:53     ` Michal Marek
2016-03-05  7:12       ` Michal Marek
2016-03-06  2:33         ` Nicolas Pitre
2016-03-06  6:20           ` Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 6/8] create/adjust generated/autoksyms.h Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 7/8] kbuild: build sample modules along with the rest of the kernel Nicolas Pitre
2016-03-04  5:40 ` [PATCH v5 8/8] kconfig option for TRIM_UNUSED_KSYMS Nicolas Pitre

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=1457070050-1564-5-git-send-email-nicolas.pitre@linaro.org \
    --to=nicolas.pitre@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    /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.