Skip to content

Commit 44f8719

Browse files
committed
kbuild: parameterize the .o part of suffix-search
The suffix-search macro hard-codes the suffix, '.o'. Make it a parameter so that the multi-search and real-search macros can be reused for foo-dtbs syntax introduced by commit 15d16d6 ("kbuild: Add generic rule to apply fdtoverlay"). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 23243c1 commit 44f8719

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎scripts/Makefile.lib‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,22 @@ else
4444
obj-y := $(filter-out %/, $(obj-y))
4545
endif
4646

47-
# Expand $(foo-objs) $(foo-y) by calling $(call suffix-search,foo.o,-objs -y)
48-
suffix-search = $(strip $(foreach s, $2, $($(1:.o=$s))))
47+
# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
48+
suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
49+
# List composite targets that are constructed by combining other targets
50+
multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $m)))
51+
# List primitive targets that are compiled from source files
52+
real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $(call suffix-search, $m, $2, $3), $m))
53+
4954
# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
50-
multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $m)))
51-
multi-obj-y := $(call multi-search,$(obj-y),-objs -y)
52-
multi-obj-m := $(call multi-search,$(obj-m),-objs -y -m)
55+
multi-obj-y := $(call multi-search, $(obj-y), .o, -objs -y)
56+
multi-obj-m := $(call multi-search, $(obj-m), .o, -objs -y -m)
5357
multi-obj-ym := $(multi-obj-y) $(multi-obj-m)
5458

5559
# Replace multi-part objects by their individual parts,
5660
# including built-in.a from subdirectories
57-
real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $(call suffix-search, $m, $2), $m))
58-
real-obj-y := $(call real-search, $(obj-y),-objs -y)
59-
real-obj-m := $(call real-search, $(obj-m),-objs -y -m)
61+
real-obj-y := $(call real-search, $(obj-y), .o, -objs -y)
62+
real-obj-m := $(call real-search, $(obj-m), .o, -objs -y -m)
6063

6164
always-y += $(always-m)
6265

0 commit comments

Comments
 (0)