]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
kbuild: de-duplicate fixdep usage
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 20 May 2025 05:21:12 +0000 (08:21 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 30 May 2025 00:42:37 +0000 (18:42 -0600)
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>
scripts/Kbuild.include
scripts/Makefile.build

index 054dd157485cfb50c6165de8faf60fbafeb797d7..7468223d32335532ea760e6b0bb25954894b4031 100644 (file)
@@ -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,
index 90aed148c44b916f9e4681a75a17913765e224f5..10f31a57a0f931cdf4dcebe0b938e8c5235010d9 100644 (file)
@@ -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