diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2025-05-20 08:21:12 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-05-29 18:42:37 -0600 |
commit | afba83ad89d5b17fc49f47df3a8c031a23815d1a (patch) | |
tree | 8a622490dbb60b9396cf88683d794939fd63f054 | |
parent | be2bdfd0199f37fed0ce19f90840f79d185e20d1 (diff) |
kbuild: de-duplicate fixdep usage
Backported from the linux kernel
commit e4aca4595005 ("kbuild: de-duplicate fixdep usage")
A lot of the kernels kbuild depend on that patch. Backport it and pull in
the 'rule_as_o_S'a rule as well. This might end up being unused but it
doesn't break anything and makes diffing the files easier.
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r-- | scripts/Kbuild.include | 5 | ||||
-rw-r--r-- | scripts/Makefile.build | 17 |
2 files changed, 14 insertions, 8 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 054dd157485..7468223d323 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -266,10 +266,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 90aed148c44..10f31a57a0f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -241,14 +241,17 @@ 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 + $(cmd_objtool) \ + $(call echo-cmd,record_mcount) $(cmd_record_mcount) +endef + +define rule_as_o_S + $(call cmd_and_fixdep,as_o_S) + $(call cmd,gen_ksymdeps) + $(call cmd,objtool) + $(call cmd,modversions_S) endef # Built-in and composite module parts |