more mv-if-changed

James Mastros (root@jennifer-unix.dyn.ml.org)
Tue, 12 Aug 1997 15:31:47 -0400 (EDT)


Hey!

This is an updated version of the mv-if-changed. It's more general now
(make dep, and module versionioing), and it dosn't leave the temp files
about anymore (whops!). Also, it won't complain if the second file dosn't
exist (but note that if it dosn't, then you probably aren't using
mv-if-changed properly).

OK, I'll make it short this time <G>.

-=- James Mastros

Ohh... This is against 2.1.49, but it should apply with no more than a bit
of fuzz to almost anything.

---

--- linux/scripts/mv-if-changed.flat Tue Aug 12 13:31:44 1997 +++ linux/scripts/mv-if-changed Tue Aug 12 14:45:55 1997 @@ -0,0 +1,13 @@ +#!/bin/sh + +# Aug 12 1997 - James Mastros (abszero@epix.net) - mv $1 $2, but only if +# cmp $1 $2 reports changes. Otherwise, rm the first file. + +if [-r $2] +then + if cmp $1 $2 + then + echo $2 unchanged. + rm $1 + else + echo $2 changed. + mv $1 $2 + fi +else + mv $1 $2 +fi --- linux/scripts/Configure.flat Sun Aug 10 18:22:06 1997 +++ linux/scripts/Configure Sun Aug 10 21:14:04 1997 @@ -1,4 +1,3 @@ - #! /bin/sh # # This script is used to configure the linux kernel. @@ -50,6 +49,10 @@ # 300397 Phil Blundell (pjb27@cam.ac.uk) - added support for min/max # arguments to "int", allow dep_tristate to take a list of dependencies # rather than just one. +# +# 100897 James Mastros (abszero@epix.net) - only update the configuration +# files if they were changed; less recompilation that way. Will only be used +# if "cmp" is on the path. # # Make sure we're really running bash. @@ -514,10 +517,11 @@ rm -f .config.old if [ -f .config ]; then - mv .config .config.old + cp .config .config.old fi -mv .tmpconfig .config -mv .tmpconfig.h include/linux/autoconf.h + +scripts/mv-if-changed .tmpconfig .config +scripts/mv-if-changed .tmpconfig.h include/linux/autoconf.h echo echo "The linux kernel is now hopefully configured for your setup." --- linux/Makefile.flat Mon Aug 11 05:06:47 1997 +++ linux/Makefile Tue Aug 12 14:26:30 1997 @@ -242,12 +242,12 @@ echo \#define LINUX_COMPILE_DOMAIN ; \ fi >> .ver @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver - @mv -f .ver $@ + @. scripts/mv-if-changed .ver $@ include/linux/version.h: ./Makefile @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver - @mv -f .ver $@ + @. scripts/mv-if-changed .ver $@ init/version.o: init/version.c include/linux/compile.h $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c @@ -372,7 +372,7 @@ scripts/mkdep init/*.c > .tmpdepend scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done - mv .tmpdepend .depend + . scripts/mv-if-changed .tmpdepend .depend MODVERFILE := --- linux/Rules.make.flat Mon Aug 11 05:12:57 1997 +++ linux/Rules.make Mon Aug 11 05:15:57 1997 @@ -88,7 +88,8 @@ # This make dependencies quickly # fastdep: dummy - $(TOPDIR)/scripts/mkdep *.[chS] > .depend + $(TOPDIR)/scripts/mkdep *.[chS] > .tmpdepend + . $(TOPDIR)/scripts/mv-if-changed .tmpdepend .depend ifdef ALL_SUB_DIRS set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done endif @@ -178,8 +179,9 @@ if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; fi; \ done; \ echo "#endif"; \ - ) > $@ - + ) > $@.tmp + @. $(TOPDIR)/scripts/mv-if-changed $@.tmp $@ + dep fastdep: $(TOPDIR)/include/linux/modversions.h endif # SYMTAB_OBJS