]> git.hungrycats.org Git - linux/commitdiff
kbuild: Get rid of -DMODVERSIONS, further cleanup
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Sat, 1 Jun 2002 20:06:51 +0000 (15:06 -0500)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Sat, 1 Jun 2002 20:06:51 +0000 (15:06 -0500)
-DMODVERSIONS isn't used anymore, so it can go. Also, after cleaning
up include/linux/module.h, it's obvious that we don't need
include/linux/modversions.h at all if CONFIG_MODVERSIONS not set,
no need to generate it.

Rules.make explicitly lists files which depend on modversions.h,
since make dep cannot know about the
"-include include/linux/modversions.h" which gets added to
the command line. Now that we understand when it is needed, we can
even get that list right ;-)

Oh well, nice theory. .hdepend will touch module.h when modversions.h
changes, so we still get unnecessary recompiles. We really need to
switch to the new way of dependency generation, it gets all that
right without even thinking about these special cases.

We don't track dependencies for .ver files. In fact, we relied on that
checksum would only change if the corresponding exporting C source
changes. That's not true, of course, all of the included headers have
say as well. So we better force the hash to be checked
unconditionally every time "make dep" is run.

Makefile
Rules.make

index f47f36b506ad279f4e9ae74fd8cd18c7e4ee7588..572d4d6b7cdaf8ddc948b582d972ab5a10ca51f3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -279,14 +279,14 @@ depend dep: .hdepend
          $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
        scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > $@
        @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
+ifdef CONFIG_MODVERSIONS
        @$(MAKE) include/linux/modversions.h
+endif
        @$(MAKE) archdep
 
 $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
        @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
 
-ifdef CONFIG_MODVERSIONS
-
 #      Update modversions.h, but only if it would change.
 
 include/linux/modversions.h: FORCE
@@ -307,13 +307,6 @@ include/linux/modversions.h: FORCE
                mv -f $@.tmp $@; \
        fi
 
-else # CONFIG_MODVERSIONS
-
-include/linux/modversions.h:
-       @echo "#include <linux/modsetver.h>" > $@
-
-endif # CONFIG_MODVERSIONS
-
 # ---------------------------------------------------------------------------
 # Modules
 
@@ -322,7 +315,7 @@ ifdef CONFIG_MODULES
 #      Build modules
 
 ifdef CONFIG_MODVERSIONS
-MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
+MODFLAGS += -include $(HPATH)/linux/modversions.h
 endif
 
 .PHONY: modules
index 46452a939f34775c332ae630499d7c5398433966..03b28bb1ddffc4f29949a8c49321d52881a7699e 100644 (file)
@@ -291,9 +291,6 @@ script:
 #
 ifdef CONFIG_MODULES
 
-multi-objs     := $(foreach m, $(obj-y) $(obj-m), $($(basename $(m))-objs))
-active-objs    := $(sort $(multi-objs) $(obj-y) $(obj-m))
-
 ifdef CONFIG_MODVERSIONS
 ifneq "$(strip $(export-objs))" ""
 
@@ -311,32 +308,36 @@ else
        genksyms_smp_prefix := 
 endif
 
-$(MODINCL)/$(MODPREFIX)%.ver: %.c
-       @if [ ! -r $(MODINCL)/$(MODPREFIX)$*.stamp -o $(MODINCL)/$(MODPREFIX)$*.stamp -ot $< ]; then \
-               echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $<'; \
-               echo '| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp'; \
-               $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< \
-               | $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
-               if [ -r $@ ] && cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f $@.tmp; \
-               else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
-       fi; touch $(MODINCL)/$(MODPREFIX)$*.stamp
+# We don't track dependencies for .ver files, so we FORCE to check
+# them always (i.e. always at "make dep" time).
+
+cmd_create_ver = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< | \
+                $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
 
-$(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
+$(MODINCL)/$(MODPREFIX)%.ver: %.c FORCE
+       @echo $(cmd_create_ver)
+       @$(cmd_create_ver)
+       @if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+         echo $@ is unchanged; rm -f $@.tmp; \
+       else \
+         echo mv $@.tmp $@; mv -f $@.tmp $@; \
+       fi
 
 # updates .ver files but not modversions.h
 fastdep: $(addprefix $(MODINCL)/$(MODPREFIX),$(export-objs:.o=.ver))
 
 endif # export-objs 
 
-$(active-objs): $(TOPDIR)/include/linux/modversions.h
-
-endif # CONFIG_MODVERSIONS
-
-ifneq "$(strip $(export-objs))" ""
+# make dep cannot correctly figure out the dependency on the generated
+# modversions.h, so we list them here:
+# o files which export symbols and are compiled into the kernel include
+#   it (to generate a correct symbol table)
+# o all modules get compiled with -include modversions.h
 
-$(export-objs): $(TOPDIR)/include/linux/modversions.h
+$(filter $(export-objs),$(real-objs-y)): $(TOPDIR)/include/linux/modversions.h
+$(real-objs-m): $(TOPDIR)/include/linux/modversions.h
 
-endif
+endif # CONFIG_MODVERSIONS
 
 endif # CONFIG_MODULES