aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2016-02-17 15:50:06 -0500
committerTom Rini <trini@konsulko.com>2024-05-23 16:19:43 -0600
commit0e4a1aeea636dd205436719845998c7c1bf2b37d (patch)
tree69fc38e72b4c19c34f324d50b2dba37f8253a52c
parent0473378d4c4c6287783f30c7b3432ae6ee3aca02 (diff)
downloadu-boot-0e4a1aeea636dd205436719845998c7c1bf2b37d.zip
u-boot-0e4a1aeea636dd205436719845998c7c1bf2b37d.tar.gz
u-boot-0e4a1aeea636dd205436719845998c7c1bf2b37d.tar.bz2
kbuild: de-duplicate fixdep usage
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>
-rw-r--r--scripts/Kbuild.include5
-rw-r--r--scripts/Makefile.build19
2 files changed, 9 insertions, 15 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 62e0207..9390ea2 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -262,10 +262,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 fb8f0a0..04acd7a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -262,24 +262,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
# Built-in and composite module parts