]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - scripts/Makefile.lib
kbuild: improve multi-objs dependency and cleanups
[karo-tx-uboot.git] / scripts / Makefile.lib
index 072abaafb189b9f512a677e67ca2a571af2ce2c4..9d1383a38f727982a52fa2b6e87a8d72f8b63591 100644 (file)
@@ -160,6 +160,15 @@ dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 modname-multi = $(sort $(foreach m,$(multi-used),\
                $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
 
+# Useful for describing the dependency of composite objects
+# Usage:
+#   $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)
+define multi_depend
+$(foreach m, $(notdir $1), \
+       $(eval $(obj)/$m: \
+       $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+endef
+
 ifdef REGENERATE_PARSERS
 
 # GPERF