kbuild: Rename some module postprocessing stuff
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 14 Feb 2003 16:15:11 +0000 (10:15 -0600)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 14 Feb 2003 16:15:11 +0000 (10:15 -0600)
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).

Makefile
scripts/Makefile.modpost [new file with mode: 0644]
scripts/Makefile.modver [deleted file]
scripts/modpost.c

index 790a6da..29464fe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -508,7 +508,7 @@ all: modules
 .PHONY: modules
 modules: $(SUBDIRS) $(if $(CONFIG_MODVERSIONS),vmlinux)
        @echo '  Building modules, stage 2.';
-       $(Q)$(MAKE) -rR -f scripts/Makefile.modver
+       $(Q)$(MAKE) -rR -f scripts/Makefile.modpost
 
 #      Install modules
 
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
new file mode 100644 (file)
index 0000000..a7ab45e
--- /dev/null
@@ -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
diff --git a/scripts/Makefile.modver b/scripts/Makefile.modver
deleted file mode 100644 (file)
index e89ed09..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-# ===========================================================================
-# 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 %.ver.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=.ver.o): %.ver.o: %.ver.c include/linux/compile.h FORCE
-       $(call if_changed,cc_o_c)
-
-targets += $(modules:.ko=.ver.o)
-
-# All the .ver.c files are generated using the helper "modpost"
-
-.PHONY: __modpost
-
-$(modules:.ko=.ver.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
index b10352e..5b21b7a 100644 (file)
@@ -15,6 +15,8 @@
 
 /* Are we using CONFIG_MODVERSIONS? */
 int modversions = 0;
+/* Do we have vmlinux? */
+int have_vmlinux = 0;
 
 void
 fatal(const char *fmt, ...)
@@ -308,6 +310,11 @@ read_symbols(char *modname)
        struct elf_info info = { };
        Elf_Sym *sym;
 
+       /* When there's no vmlinux, don't print warnings about
+        * unresolved symbols (since there'll be too many ;) */
+       if (strcmp(modname, "vmlinux") == 0)
+               have_vmlinux = 1;
+
        parse_elf(&info, modname);
 
        mod = new_module(modname);
@@ -379,9 +386,9 @@ add_versions(struct buffer *b, struct module *mod)
        for (s = mod->unres; s; s = s->next) {
                exp = find_symbol(s->name);
                if (!exp) {
-                       fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
-                               "undefined!\n",
-                               s->name, mod->name);
+                       if (have_vmlinux)
+                               fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
+                               "undefined!\n", s->name, mod->name);
                        continue;
                }
                s->module = exp->module;
@@ -512,7 +519,7 @@ main(int argc, char **argv)
                add_depends(&buf, mod, modules);
                add_moddevtable(&buf, mod);
 
-               sprintf(fname, "%s.ver.c", mod->name);
+               sprintf(fname, "%s.mod.c", mod->name);
                write_if_changed(&buf, fname);
        }
        return 0;