Skip to content

Commit

Permalink
kbuild: move $(strip ) to suffix-search definition
Browse files Browse the repository at this point in the history
Move $(strip ...) to the callee from the callers of suffix-search. It
shortens the code slightly. Adding a space after a comma will not be
a matter. I also dropped parentheses from single character variables.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
  • Loading branch information
masahir0y committed Apr 24, 2021
1 parent a6601e0 commit a34e6d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ 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)))
suffix-search = $(strip $(foreach s, $2, $($(1:.o=$s))))
# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
multi-search = $(sort $(foreach m,$(1), $(if $(strip $(call suffix-search,$(m),$(2) -)), $(m))))
multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2 -), $m)))
multi-obj-y := $(call multi-search,$(obj-y),-objs -y)
multi-obj-m := $(call multi-search,$(obj-m),-objs -y -m)
multi-obj-ym := $(multi-obj-y) $(multi-obj-m)

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

Expand Down

0 comments on commit a34e6d1

Please sign in to comment.