]> git.hungrycats.org Git - linux/commitdiff
kbuild: clean up generation of modversions.h
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Sat, 1 Jun 2002 19:55:48 +0000 (14:55 -0500)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Sat, 1 Jun 2002 19:55:48 +0000 (14:55 -0500)
There's no good reason why we would generate
include/linux/modversions.h from the top-level Makefile when
CONFIG_MODVERSION=y and from Rules.make otherwise.

Nor is there a good reason to call the target to do so
"update-modverfile" - "include/linux/modversions.h" makes
much more sense.

Makefile
Rules.make

index 3f4c769222b5961bc6452f0048884a269b61617a..f47f36b506ad279f4e9ae74fd8cd18c7e4ee7588 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -261,6 +261,9 @@ scripts/mkdep scripts/split-include : FORCE
 # Generate dependencies
 # ---------------------------------------------------------------------------
 
+#      In the same pass, generate module versions, that's why it's
+#      all mixed up here.
+
 .PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS))
 
 depend dep: .hdepend
@@ -276,16 +279,17 @@ 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) update-modverfile
-endif
+       @$(MAKE) include/linux/modversions.h
        @$(MAKE) archdep
 
 $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
        @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
 
-# update modversions.h, but only if it would change
-update-modverfile:
+ifdef CONFIG_MODVERSIONS
+
+#      Update modversions.h, but only if it would change.
+
+include/linux/modversions.h: FORCE
        @(echo "#ifndef _LINUX_MODVERSIONS_H";\
          echo "#define _LINUX_MODVERSIONS_H"; \
          echo "#include <linux/modsetver.h>"; \
@@ -294,15 +298,22 @@ update-modverfile:
            if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \
          done; \
          echo "#endif"; \
-       ) > $(TOPDIR)/include/linux/modversions.h.tmp
-       @if [ -r $(TOPDIR)/include/linux/modversions.h ] && cmp -s $(TOPDIR)/include/linux/modversions.h $(TOPDIR)/include/linux/modversions.h.tmp; then \
-               echo $(TOPDIR)/include/linux/modversions.h was not updated; \
-               rm -f $(TOPDIR)/include/linux/modversions.h.tmp; \
+       ) > $@.tmp
+       @if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+               echo $@ was not updated; \
+               rm -f $@.tmp; \
        else \
-               echo $(TOPDIR)/include/linux/modversions.h was updated; \
-               mv -f $(TOPDIR)/include/linux/modversions.h.tmp $(TOPDIR)/include/linux/modversions.h; \
+               echo $@ was updated; \
+               mv -f $@.tmp $@; \
        fi
 
+else # CONFIG_MODVERSIONS
+
+include/linux/modversions.h:
+       @echo "#include <linux/modsetver.h>" > $@
+
+endif # CONFIG_MODVERSIONS
+
 # ---------------------------------------------------------------------------
 # Modules
 
index 32097157dc4473b89b63ba5b5839f9039d82926f..46452a939f34775c332ae630499d7c5398433966 100644 (file)
@@ -330,11 +330,6 @@ endif # export-objs
 
 $(active-objs): $(TOPDIR)/include/linux/modversions.h
 
-else
-
-$(TOPDIR)/include/linux/modversions.h:
-       @echo "#include <linux/modsetver.h>" > $@
-
 endif # CONFIG_MODVERSIONS
 
 ifneq "$(strip $(export-objs))" ""
@@ -400,4 +395,3 @@ if_changed = $(if $(strip $? \
                          $(filter-out $($(1)),$(cmd_$(@F)))\
                          $(filter-out $(cmd_$(@F)),$($(1)))),\
               @echo '$($(1))' && $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd)
-