kbuild: reuse suffix-search to refactor multi_depend
authorMasahiro Yamada <masahiroy@kernel.org>
Wed, 6 Apr 2022 15:30:17 +0000 (00:30 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sat, 7 May 2022 18:16:58 +0000 (03:16 +0900)
The complicated part of multi_depend is the same as suffix-search.

Reuse it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/Makefile.lib

index 9f69ecd..d56cda3 100644 (file)
@@ -238,7 +238,7 @@ endif
 define multi_depend
 $(foreach m, $(notdir $1), \
        $(eval $(obj)/$m: \
-       $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+       $(addprefix $(obj)/, $(call suffix-search, $m, $2, $3))))
 endef
 
 # Copy a file