Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 993d65f1 authored by Elliot Berman's avatar Elliot Berman Committed by Jeff Johnson
Browse files

Kbuild: Make composite object searching more generic



Reduce repeated logic around expanding composite objects in preparation
for later commit to support nested composite objects.

Change-Id: I9f2f4788bd4a85f105432e4827f9984cd488b647
Signed-off-by: default avatarElliot Berman <eberman@codeaurora.org>
Signed-off-by: default avatarJeff Johnson <jjohnson@codeaurora.org>
parent 9c25b460
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -41,9 +41,12 @@ obj-m := $(filter-out %/, $(obj-m))
# Subdirectories we need to descend into
# Subdirectories we need to descend into
subdir-ym	:= $(sort $(subdir-y) $(subdir-m))
subdir-ym	:= $(sort $(subdir-y) $(subdir-m))


# 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
# 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-search = $(sort $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)), $(m))))
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(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)
multi-used   := $(multi-used-y) $(multi-used-m)


# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
@@ -52,8 +55,9 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y))


# Replace multi-part objects by their individual parts,
# Replace multi-part objects by their individual parts,
# including built-in.a from subdirectories
# 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-search = $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)),$(call suffix-search,$(m),$(2)),$(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-obj-y := $(call real-search, $(obj-y),-objs -y)
real-obj-m := $(call real-search, $(obj-m),-objs -y -m)


# DTB
# DTB
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built