summaryrefslogtreecommitdiff
path: root/scripts/Makefile.modpost
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-02-14 10:15:11 -0600
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-02-14 10:15:11 -0600
commit1cc0e0529569bf6a94f6d49770aa6d4b599d2c46 (patch)
tree22e39910152d64e923ab4e6ae10eb8a47f8db1da /scripts/Makefile.modpost
parentf864c7c2f6732d95cb30cf7b0b2a02c40e1c2bc8 (diff)
kbuild: Rename some module postprocessing stuff
Since it's now not only used for modversioning but generally, rename the Makefile .modver -> .modpost and the generated files to <module>.ver.[co]. Also, when there's now vmlinux during module postprocessing, don't print warnings on unresolved symbols (there's just too many, then).
Diffstat (limited to 'scripts/Makefile.modpost')
-rw-r--r--scripts/Makefile.modpost81
1 files changed, 81 insertions, 0 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
new file mode 100644
index 000000000000..a7ab45ec7839
--- /dev/null
+++ b/scripts/Makefile.modpost
@@ -0,0 +1,81 @@
+# ===========================================================================
+# Module versions
+# ===========================================================================
+
+.PHONY: __modversions
+__modversions:
+
+include .config
+include scripts/Makefile.lib
+
+#
+
+__modules := $(shell cat /dev/null $(wildcard $(MODVERDIR)/*.mod))
+modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
+
+ifneq ($(filter-out $(modules),$(__modules)),)
+ $(warning *** Uh-oh, you have stale module entries. You messed with SUBDIRS,)
+ $(warning do not complain if something goes wrong.)
+endif
+
+__modversions: $(modules)
+ @:
+
+# The final module link
+
+quiet_cmd_ld_ko_o = LD [M] $@
+ cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
+ $(filter-out FORCE,$^)
+
+$(modules): %.ko :%.o %.mod.o FORCE
+ $(call if_changed,ld_ko_o)
+
+targets += $(modules)
+
+# Compile version info for unresolved symbols
+
+quiet_cmd_cc_o_c = CC $@
+ cmd_cc_o_c = $(CC) $(CFLAGS) $(CFLAGS_MODULE) -c -o $@ $<
+
+# We have a fake dependency on compile.h to make sure that we
+# notice if the compiler version changes under us.
+
+$(modules:.ko=.mod.o): %.mod.o: %.mod.c include/linux/compile.h FORCE
+ $(call if_changed,cc_o_c)
+
+targets += $(modules:.ko=.mod.o)
+
+# All the .mod.c files are generated using the helper "modpost"
+
+.PHONY: __modpost
+
+$(modules:.ko=.mod.c): __modpost ;
+
+# Extract all checksums for all exported symbols
+
+quiet_cmd_modpost = MODPOST
+ cmd_modpost = scripts/modpost $^
+
+__modpost: $(wildcard vmlinux) $(modules:.ko=.o)
+ $(call if_changed,modpost)
+
+targets += __modpost
+
+# Add FORCE to the prequisites of a target to force it to be always rebuilt.
+# ---------------------------------------------------------------------------
+
+.PHONY: FORCE
+
+FORCE:
+
+# Read all saved command lines and dependencies for the $(targets) we
+# may be building above, using $(if_changed{,_dep}). As an
+# optimization, we don't need to read them if the target does not
+# exist, we will rebuild anyway in that case.
+
+targets := $(wildcard $(sort $(targets)))
+cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+
+ifneq ($(cmd_files),)
+ include $(cmd_files)
+endif