summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-12-04 01:36:09 -0600
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-12-04 01:36:09 -0600
commit5991f8158084d078d4204c7a28d568ffbc962ab1 (patch)
treed9217c336421f7baa0d721703323b7d7341f15f6 /scripts
parent6802d702761dfdd910e37da40ba95fa71fd06dd7 (diff)
kbuild: Build modules as '.ko'
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build22
-rw-r--r--scripts/Makefile.lib2
-rw-r--r--scripts/Makefile.modinst6
3 files changed, 20 insertions, 10 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 37e73b5e0b9b..4bccbe923690 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -46,7 +46,7 @@ endif
endif
__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
- $(if $(KBUILD_MODULES),$(obj-m)) \
+ $(if $(KBUILD_MODULES),$(obj-m:.o=.ko)) \
$(subdir-ym) $(build-targets)
@:
@@ -172,21 +172,29 @@ endif
#
# Rule to link composite objects
#
+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 = LD $(quiet_modtag) $@
-cmd_link_multi = $(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)))),$^)
+
+quiet_cmd_link_single-m = LD [M] $@
+cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $<
# We would rather have a list of rules like
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
- $(call if_changed,link_multi)
+ $(call if_changed,link_multi-y)
+
+$(multi-used-m:.o=.ko) : %.ko: $(multi-objs-m) FORCE
+ $(call if_changed,link_multi-m)
-$(multi-used-m) : %.o: $(multi-objs-m) FORCE
- $(call if_changed,link_multi)
+$(single-used-m:.o=.ko) : %.ko: %.o FORCE
+ $(call if_changed,link_single-m)
-targets += $(multi-used-y) $(multi-used-m)
+targets += $(multi-used-y) $(multi-used-m:.o=.ko) $(single-used-m:.o=.ko)
# Compile programs on the host
# ===========================================================================
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 2fd252467066..f21c0905c2da 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -43,6 +43,7 @@ __obj-m = $(filter-out export.o,$(obj-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))))
multi-used := $(multi-used-y) $(multi-used-m)
+single-used-m := $(filter-out $(multi-used-m),$(obj-m))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
@@ -99,6 +100,7 @@ export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
+single-used-m := $(addprefix $(obj)/,$(single-used-m))
multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 45f5387d365f..1ea62f1c679c 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -15,12 +15,12 @@ include scripts/Makefile.lib
# ==========================================================================
-quiet_cmd_modules_install = INSTALL $(obj-m)
+quiet_cmd_modules_install = INSTALL $(obj-m:.o=.ko)
cmd_modules_install = mkdir -p $(MODLIB)/kernel && \
- cp $(obj-m) $(MODLIB)/kernel/
+ cp $(obj-m:.o=.ko) $(MODLIB)/kernel/
modules_install: $(subdir-ym)
-ifneq ($(obj-m),)
+ifneq ($(obj-m:.o=.ko),)
$(call cmd,modules_install)
else
@: