diff options
author | Elliot Berman <eberman@codeaurora.org> | 2021-01-22 11:27:17 -0800 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2021-02-16 12:01:45 +0900 |
commit | 1c3fae740aabaeb4d6b4174fc189592eba1b77d0 (patch) | |
tree | 6993a6536caf0a709d06b03d2dfcdd2920ee3ae9 /scripts/Makefile.lib | |
parent | 2047ace96679a146c8573520a080f9dfa06a2c98 (diff) | |
download | linux-stable-1c3fae740aabaeb4d6b4174fc189592eba1b77d0.tar.gz linux-stable-1c3fae740aabaeb4d6b4174fc189592eba1b77d0.tar.bz2 linux-stable-1c3fae740aabaeb4d6b4174fc189592eba1b77d0.zip |
Kbuild: Make composite object searching more generic
Reduce repeated logic around expanding composite objects.
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r-- | scripts/Makefile.lib | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e10b675165cd..6f248ff91982 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -56,15 +56,19 @@ else obj-y := $(filter-out %/, $(obj-y)) endif +# Expand $(foo-objs) $(foo-y) by calling $(call suffix-search,foo.o,-objs -y) +suffix-search = $(foreach s,$(2),$($(1:.o=$s))) # If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $(m)))) -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m)))) +multi-search = $(sort $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)), $(m)))) +multi-used-y := $(call multi-search,$(obj-y),-objs -y) +multi-used-m := $(call multi-search,$(obj-m),-objs -y -m) multi-used := $(multi-used-y) $(multi-used-m) # Replace multi-part objects by their individual parts, # including built-in.a from subdirectories -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) +real-search = $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)),$(call suffix-search,$(m),$(2)),$(m))) +real-obj-y := $(call real-search, $(obj-y),-objs -y) +real-obj-m := $(call real-search, $(obj-m),-objs -y -m) always-y += $(always-m) |