Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366698

[PATCH v7 4/8] kbuild: de-duplicate fixdep usage

From Nicolas Pitre <nicolas.pitre@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v7 4/8] kbuild: de-duplicate fixdep usage
Date 2016-03-29 22:50 +0200
Message-ID <ri8Kn-35X-29@gated-at.bofh.it> (permalink)
References <ri8Kl-35X-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The generation and postprocessing of automatic dependency rules is
duplicated in rule_cc_o_c, rule_as_o_S 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 in this area
easier.

In the rule_cc_o_c and rule_as_o_S cases 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 | 19 +++++--------------
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index b2ab2a92a3..80ca538bfb 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 74556e5e4e..12821d9eae 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -266,24 +266,15 @@ endif # CONFIG_STACK_VALIDATION
 
 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)						  \
-	$(cmd_objtool)						  \
-	$(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
+	$(cmd_objtool)						          \
+	$(call echo-cmd,record_mcount) $(cmd_record_mcount)
 endef
 
 define rule_as_o_S
-	$(call echo-cmd,as_o_S) $(cmd_as_o_S);				  \
-	$(cmd_objtool)						  \
-	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,as_o_S)' >    \
-	                                              $(dot-target).tmp;  \
-	rm -f $(depfile);						  \
-	mv -f $(dot-target).tmp $(dot-target).cmd
+	$(call cmd_and_fixdep,as_o_S)					  \
+	$(cmd_objtool)
 endef
 
 # List module undefined symbols (or empty line if not enabled)
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 0/8]/[PULL REQUEST] Trim unused exported kernel symbols Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 2/8] export.h: allow for per-symbol configurable EXPORT_SYMBOL() Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 3/8] fixdep: accept extra dependencies on stdin Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 4/8] kbuild: de-duplicate fixdep usage Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 1/8] kbuild: record needed exported symbols for modules Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 8/8] kconfig option for TRIM_UNUSED_KSYMS Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 6/8] kbuild: create/adjust generated/autoksyms.h Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200
  [PATCH v7 7/8] kbuild: build sample modules along with the rest of the kernel Nicolas Pitre <nicolas.pitre@linaro.org> - 2016-03-29 22:50 +0200

csiph-web