From: Ilias Apalodimas Date: Tue, 20 May 2025 05:21:12 +0000 (+0300) Subject: kbuild: de-duplicate fixdep usage X-Git-Tag: v2025.10-rc1~118^2~61^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afba83ad89d5b17fc49f47df3a8c031a23815d1a;p=thirdparty%2Fu-boot.git 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 --- 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