Skip to content

Commit

Permalink
kbuild: refactor subdir-ym calculation
Browse files Browse the repository at this point in the history
Remove the unneeded variables, __subdir-y and __subdir-m.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed Jun 1, 2020
1 parent fb2d99b commit 0a8820e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,21 @@ ifdef need-modorder
modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
endif

# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m) \
$(patsubst %/,%, $(filter %/, $(obj-y) $(obj-m))))

# Handle objects in subdirs
# ---------------------------------------------------------------------------
# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a
# and add the directory to the list of dirs to descend into: $(subdir-y)
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
# and add the directory to the list of dirs to descend into: $(subdir-m)
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
subdir-m += $(__subdir-m)
ifdef need-builtin
obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
else
obj-y := $(filter-out %/, $(obj-y))
endif
obj-m := $(filter-out %/, $(obj-m))

# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m))

# 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))))
Expand Down

0 comments on commit 0a8820e

Please sign in to comment.