summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-10-23 11:59:59 -0500
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-10-23 11:59:59 -0500
commit1752729653ae35381ace4aa664c868e6e263db97 (patch)
treeb9371c56e8c708a811c820f622ea99936f75c4f8 /scripts
parent52d6eeb218cbc112c2e556784dc052d0e2f1f3f2 (diff)
kbuild: Allow for <mod>-y as well as <mod>-objs for multipart objects.
Traditionally, the individual components of a multipart module are listed in <mod>-objs. Allow for using <mod>-y as well, as that turns out to simplify declaring optional parts of multi-part modules, see the converted examples in net/*/Makefile. This change is backwards-compatible, i.e. not converted Makefiles still work just fine.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index dab20c07e6b1..31836de5f958 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -77,21 +77,21 @@ __obj-y = $(filter-out export.o,$(obj-y))
__obj-m = $(filter-out export.o,$(obj-m))
# if $(foo-objs) exists, foo.o is a composite object
-multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $($(m:.o=-objs)), $(m))))
-multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(m:.o=-objs)), $(m))))
+multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
+multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
-multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)))
-multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)))
+multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
+multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live
# in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# Replace multi-part objects by their individual parts, look at local dir only
-real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS)
-real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
+real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(EXTRA_TARGETS)
+real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
# Only build module versions for files which are selected to be built
export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m))
@@ -249,7 +249,7 @@ endif
#
quiet_cmd_link_multi = LD $@
-cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs)))),$^)
+cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
# We would rather have a list of rules like
# foo.o: $(foo-objs)