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.apalodi...@linaro.org> --- scripts/Kbuild.include | 5 ++++- scripts/Makefile.build | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 054dd157485c..7468223d3233 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 90aed148c44b..10f31a57a0f9 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 -- 2.49.0