summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-06-05 03:01:16 -0500
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-06-05 03:01:16 -0500
commit67b956337053ee98c898e0890ae35f9318004bfd (patch)
treee21b5e721399ea205a574be6b69f186b1caa4e6c /Makefile
parent9d0ac54b0fa5000dcefa1186ed72c5ee755fbf0a (diff)
kbuild: modversions improvements
If an object was changed to not export symbols anymore, the corresponding stale .ver file would have been left lying around and been picked up when generating modversions.h. The obvious solution to remove include/linux/modules/* at the beginning of "make dep" is not really good, since that means that .ver files would be regenerated unconditionally, thus causing a lot of possibly unnecessary rebuilds. So, instead, we build a temporary shadow tree of all export-objs (as empty files) during the recursive "make fastdep" phase, and use that to generate modversions.h. Ensure that we touch include/linux/modversions.h if any of the .ver files changes, that's our marker to rebuild all modversions affected files.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile63
1 files changed, 27 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 6d0bd1a8136f..621f0f75df09 100644
--- a/Makefile
+++ b/Makefile
@@ -245,15 +245,14 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
# Handle descending into subdirectories listed in $(SUBDIRS)
.PHONY: $(SUBDIRS)
-$(SUBDIRS): prepare
+$(SUBDIRS): .hdepend prepare include/config/MARKER
@$(MAKE) -C $@
-# Things we need done before we even start the actual build.
-# The dependency on .hdepend will in turn take care of
-# include/asm, include/linux/version etc.
+# Things we need done before we descend to build or make
+# module versions are listed in "prepare"
.PHONY: prepare
-prepare: .hdepend include/config/MARKER
+prepare: include/linux/version.h include/asm
# Single targets
# ---------------------------------------------------------------------------
@@ -326,39 +325,29 @@ scripts:
depend dep: .hdepend
-ifdef CONFIG_MODVERSIONS
-
-# Before descending for the actual build, we need module
-# versions done. - Still using the old, illogical name
-# .hdepend
-
-# .hdepend only indicates if we have generated module
-# version checksums before now. For now, if they've
-# been generated once, no rechecking will be done unless
-# explicitly asked for using "make dep".
+# .hdepend is our (misnomed) marker for whether we've run
+# generated module versions and made archdep
-.hdepend: scripts/fixdep include/linux/version.h include/asm \
- $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
- touch $@
- @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
- @$(MAKE) include/linux/modversions.h
- @$(MAKE) archdep
+.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
+ @$(MAKE) archdep include/linux/modversions.h
+ @touch $@
-$(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
- @(echo "#ifndef _LINUX_MODVERSIONS_H";\
- echo "#define _LINUX_MODVERSIONS_H"; \
- echo "#include <linux/modsetver.h>"; \
- cd $(TOPDIR)/include/linux; \
- for f in `find modules -name \*.ver`; do \
- echo "#include <linux/$${f}>"; \
- done; \
- echo "#endif"; \
+include/linux/modversions.h: scripts/fixdep prepare FORCE
+ @rm -rf .tmp_export-objs
+ @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
+ @( echo "#ifndef _LINUX_MODVERSIONS_H";\
+ echo "#define _LINUX_MODVERSIONS_H"; \
+ echo "#include <linux/modsetver.h>"; \
+ for f in `cd .tmp_export-objs; find modules -name \*.ver -print`; do \
+ echo "#include <linux/$${f}>"; \
+ done; \
+ echo "#endif"; \
) > $@.tmp
+ @rm -rf .tmp_export-objs
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
echo $@ was not updated; \
rm -f $@.tmp; \
@@ -367,12 +356,14 @@ include/linux/modversions.h: FORCE
mv -f $@.tmp $@; \
fi
+$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
+ @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep
+
else # !CONFIG_MODVERSIONS
-.hdepend: include/linux/version.h include/asm \
- $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
- touch $@
- @$(MAKE) archdep
+.PHONY: include/linux/modversions.h
+
+include/linux/modversions.h:
endif # CONFIG_MODVERSIONS