summaryrefslogtreecommitdiff
path: root/Rules.make
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-03-15 02:19:57 -0600
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-03-15 02:19:57 -0600
commit9f1021aa0d3be21bc59fa7afc1f68c9592d091d6 (patch)
tree002acc001f96949f0e1eeec222a47d170807c4b9 /Rules.make
parent139d39f9273540fb3e98c336382b389cd9f7c030 (diff)
Improve Rules.make to automatically generate link rules for composite
objects. Current behavior is not changed at all, but see the next cset for what it's good for.
Diffstat (limited to 'Rules.make')
-rw-r--r--Rules.make21
1 files changed, 19 insertions, 2 deletions
diff --git a/Rules.make b/Rules.make
index b084d59e04e9..2d3c5faf21a7 100644
--- a/Rules.make
+++ b/Rules.make
@@ -120,6 +120,24 @@ $(L_TARGET): $(obj-y)
) > $(dir $@)/.$(notdir $@).flags
endif
+#
+# Rule to link composite objects
+#
+
+# for make >= 3.78 the following is cleaner:
+# multi-used := $(foreach m,$(obj-y) $(obj-m), $(if $($(basename $(m))-objs), $(m)))
+multi-used := $(sort $(foreach m,$(obj-y) $(obj-m),$(patsubst %,$(m),$($(basename $(m))-objs))))
+ld-multi-used := $(filter-out $(list-multi),$(multi-used))
+ld-multi-objs := $(foreach m, $(ld-multi-used), $($(basename $(m))-objs))
+
+$(ld-multi-used) : %.o: $(ld-multi-objs)
+ rm -f $@
+ $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs), $^)
+ @ ( \
+ echo 'ifeq ($(strip $(subst $(comma),:,$(LD) $(EXTRA_LDFLAGS) $($(basename $@)-objs)),$$(strip $$(subst $$(comma),:,$$(LD) $$(EXTRA_LDFLAGS) $$($(basename $@)-objs)))))' ; \
+ echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
+ echo 'endif' \
+ ) > $(dir $@)/.$(notdir $@).flags
#
# This make dependencies quickly
@@ -200,8 +218,7 @@ script:
#
ifdef CONFIG_MODULES
-multi-used := $(filter $(list-multi), $(obj-y) $(obj-m))
-multi-objs := $(foreach m, $(multi-used), $($(basename $(m))-objs))
+multi-objs := $(foreach m, $(obj-y) $(obj-m), $($(basename $(m))-objs))
active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
ifdef CONFIG_MODVERSIONS