Messages in this thread Patch in this message | | | Date | Fri, 28 Jul 2000 00:06:55 +0200 (MET DST) | From | Mikael Pettersson <> | Subject | Re: CONFIG_MODVERSIONS problem identified |
| |
Andreas Schwab and Russel King noted some problems with my first patch for the modversions.h problem: it wouldn't work with parallel makes (due to assuming make executes dependencies left-to-right), and it could cause excessive recompilations (due to always updating modversions.h).
Here's Version 2 of the patch which I think addresses all of the issues raised. In particular: - sequencing is expressed by shell commands - update-modverfile does the update via a temporary file, and only touches modversions.h if it actually changed This version has survived numerous 'make -j dep' on UP.
I didn't use a .PHONY: on modversions.h as Russel suggested, since that would cause re-execution of that rule whenever a target depends on modversions.h via some .{h,}depend file.
A question: Rules.make has a goal 'dep' which does the same thing as 'fastdep', however, 'fastdep' is what the top-level Makefile's 'dep' invokes. What's Rules.make's 'dep' for?
/Mikael
--- linux-2.4.0-test5-pre6/Makefile.~1~ Thu Jul 27 21:36:59 2000 +++ linux-2.4.0-test5-pre6/Makefile Thu Jul 27 21:37:24 2000 @@ -437,6 +437,9 @@ scripts/mkdep init/*.c > .depend scripts/mkdep `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" +ifdef CONFIG_MODVERSIONS + $(MAKE) update-modverfile +endif ifdef CONFIG_MODVERSIONS MODVERFILE := $(TOPDIR)/include/linux/modversions.h @@ -445,7 +448,7 @@ endif export MODVERFILE -depend dep: dep-files $(MODVERFILE) +depend dep: dep-files # make checkconfig: Prune 'scripts' directory to avoid "false positives". checkconfig: --- linux-2.4.0-test5-pre6/Rules.make.~1~ Sat Jul 1 00:13:51 2000 +++ linux-2.4.0-test5-pre6/Rules.make Thu Jul 27 22:46:54 2000 @@ -215,8 +215,16 @@ $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h -$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) - @echo updating $(TOPDIR)/include/linux/modversions.h +# updates .ver files but not modversions.h +fastdep: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) + +# updates .ver files and modversions.h like before (is this needed?) +dep: fastdep update-modverfile + +endif # SYMTAB_OBJS + +# update modversions.h, but only if it would change +update-modverfile: @(echo "#ifndef _LINUX_MODVERSIONS_H";\ echo "#define _LINUX_MODVERSIONS_H"; \ echo "#include <linux/modsetver.h>"; \ @@ -225,11 +233,14 @@ if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \ done; \ echo "#endif"; \ - ) > $@ - -dep fastdep: $(TOPDIR)/include/linux/modversions.h - -endif # SYMTAB_OBJS + ) > $(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; \ + else \ + echo $(TOPDIR)/include/linux/modversions.h was updated; \ + mv -f $(TOPDIR)/include/linux/modversions.h.tmp $(TOPDIR)/include/linux/modversions.h; \ + fi $(M_OBJS): $(TOPDIR)/include/linux/modversions.h ifdef MAKING_MODULES - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |