diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-14 08:16:21 -0600 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-14 08:16:21 -0600 |
| commit | 0e7d983baf0e669867183d9fecdeb7b83ac1940b (patch) | |
| tree | eaab7e426df7cc4e35bcb3b306e9aa5da710f600 /scripts | |
| parent | 15f1049d9f873263d5ed26ebc31ca099e807147d (diff) | |
kbuild: Always postprocess modules
Currently, we are doing the final module link (.ko) at different places
(Makefile.build vs Makefile.modver) depending on CONFIG_MODVERSIONS.
Apart from being confusing, that also means we have this code path
duplicated, and the modversions path most likely gets little testing.
It's actually cleaner to just do the final link from Makefile.modver always,
performance-wise it's not a noticable difference, since we don't descend
in that step, but just use the list of modules generated during the build.
This step is also preliminary for doing additional postprocessing, e.g.
generating module alias information from PCI / USB device tables.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 43 | ||||
| -rw-r--r-- | scripts/Makefile.modver | 2 |
2 files changed, 11 insertions, 34 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 988b49fbbca7..c32cfce4f9b8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -49,15 +49,12 @@ O_TARGET := $(obj)/built-in.o endif endif -ifdef CONFIG_MODVERSIONS -modules := $(obj-m) -touch-module = @echo $(@:.o=.ko) > .tmp_versions/$(@F:.o=.mod) -else -modules := $(obj-m:.o=.ko) -endif +# We keep a list of all modules in $(MODVERDIR) + +touch-module = @echo $(@:.o=.ko) > $(MODVERDIR)/$(@F:.o=.mod) __build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ - $(if $(KBUILD_MODULES),$(modules)) \ + $(if $(KBUILD_MODULES),$(obj-m)) \ $(subdir-ym) $(build-targets) @: @@ -155,6 +152,8 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< +# Built-in and composite module parts + %.o: %.c FORCE ifdef CONFIG_MODVERSIONS $(call if_changed_rule,vcc_o_c) @@ -162,13 +161,14 @@ else $(call if_changed_dep,cc_o_c) endif -# For modversioning, we need to special case single-part modules -# to mark them in $(MODVERDIR) +# Single-part modules are special since we need to mark them in $(MODVERDIR) -ifdef CONFIG_MODVERSIONS $(single-used-m): %.o: %.c FORCE $(touch-module) +ifdef CONFIG_MODVERSIONS $(call if_changed_rule,vcc_o_c) +else + $(call if_changed_dep,cc_o_c) endif quiet_cmd_cc_lst_c = MKLST $@ @@ -267,29 +267,6 @@ $(multi-used-m) : %.o: $(multi-objs-m) FORCE targets += $(multi-used-y) $(multi-used-m) -# -# Rule to link modules ( .o -> .ko ) -# - -# With CONFIG_MODVERSIONS, generation of the final .ko is handled -# by scripts/Makefile.modver -ifndef CONFIG_MODVERSIONS - -quiet_cmd_link_module = LD [M] $@ -cmd_link_module = $(LD) $(ld_flags) $(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 += $(single-used-m:.o=.ko) $(multi-used-m:.o=.ko) - -endif - # Compile programs on the host # =========================================================================== # host-progs := bin2hex diff --git a/scripts/Makefile.modver b/scripts/Makefile.modver index 73b0da7b8f96..13f1f8aa04f1 100644 --- a/scripts/Makefile.modver +++ b/scripts/Makefile.modver @@ -28,7 +28,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ init/vermagic.o: ; -$(modules): %.ko :%.o %.ver.o init/vermagic.o FORCE +$(modules): %.ko :%.o $(if $(CONFIG_MODVERSIONS),%.ver.o) init/vermagic.o FORCE $(call if_changed,ld_ko_o) targets += $(modules) |
