From caa9e0e04c20ce4f6884066cb2f4d4e33db07178 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Fri, 24 Jan 2003 09:51:36 -0600 Subject: kbuild: Always link module (.ko) from associated (.o) For extracting the versions and finding the unresolved symbols, we need multi-part modules to be linked together already, so this patch separates the building of the modules as a .o file from generating the .ko in the next step. --- scripts/Makefile.build | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'scripts/Makefile.build') diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 522c40663372..9581629c08bf 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -224,15 +224,7 @@ quiet_cmd_link_multi-y = LD $@ cmd_link_multi-y = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^) quiet_cmd_link_multi-m = LD [M] $@ -cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^) init/vermagic.o - -quiet_cmd_link_single-m = LD [M] $@ -cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o - -# Don't rebuilt vermagic.o unless we actually are in the init/ dir -ifneq ($(obj),init) -init/vermagic.o: ; -endif +cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -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) @@ -241,13 +233,27 @@ endif $(multi-used-y) : %.o: $(multi-objs-y) FORCE $(call if_changed,link_multi-y) -$(multi-used-m:.o=.ko) : %.ko: $(multi-objs-m) init/vermagic.o FORCE +$(multi-used-m) : %.o: $(multi-objs-m) FORCE + $(touch-module) $(call if_changed,link_multi-m) -$(single-used-m:.o=.ko) : %.ko: %.o init/vermagic.o FORCE - $(call if_changed,link_single-m) +targets += $(multi-used-y) $(multi-used-m) + +# +# Rule to link modules ( .o -> .ko ) +# +quiet_cmd_link_module = LD [M] $@ +cmd_link_module = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o + +# Don't rebuilt vermagic.o unless we actually are in the init/ dir +ifneq ($(obj),init) +init/vermagic.o: ; +endif + +$(single-used-m:.o=.ko) $(multi-used-m:.o=.ko): %.ko: %.o init/vermagic.o FORCE + $(call if_changed,link_module) -targets += $(multi-used-y) $(multi-used-m:.o=.ko) $(single-used-m:.o=.ko) +targets += $(single-used-m:.o=.ko) $(multi-used-m:.o=.ko) # Compile programs on the host # =========================================================================== -- cgit v1.2.3