]> git.hungrycats.org Git - linux/commitdiff
Improve Rules.make to automatically generate link rules for composite
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 15 Mar 2002 08:19:57 +0000 (02:19 -0600)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 15 Mar 2002 08:19:57 +0000 (02:19 -0600)
objects.

Current behavior is not changed at all, but see the next cset for what
it's good for.

Rules.make

index b084d59e04e91e9b8106abb756bf33b52cfafb4f..2d3c5faf21a7bdd5fb093885e84d67125351eb8d 100644 (file)
@@ -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