mv-if-changed for .config and autoconfig.h; less recompilitations

James Mastros (root@jennifer-unix.dyn.ml.org)
Sun, 10 Aug 1997 20:45:29 -0400 (EDT)


Hey!

This patch checks if .config and include/linux/autoconfig.h were acatually
changed before overwriting them; this significintly cuts down on the
recompilitaion rate if your like me and always do a "make oldconfig" when
you patch the kernel. Also it makes a trivial change to the top Makefile to
keep people from setting SMP to zero instead of unsetting it.

Note that this (1) only does the .config and autoconfig.h stuff, not
(notibly) the sound config stuff, or the "make dep" stuff (after all, I
can't remember the last time I did a make dep), and (2) only changes the
text-mode config, not xconfig or menuconfig (but does do oldconfig).

mv-if-changed is a sepperate script to make it trival to use in other kernel
related scripts. I just stuck in that comment in the top-level makefile
here because it dosn't warrent a patch of it's own, and to finnaly (famous
last words) end that paticular FAQ.

This is my first kernel hack that works; it is under-tested, and likely
contains bugs.

Whoh! Just found a bug. I note that the sparc makefiles assume that cmp
exists; can I do the same? Anybody know how to check if a command is
executable? Specificly, I want to check if bash can execute "cmp", but not
screw if it can't... Ahvell. A working version of the patch which,
unfortnatly, prints error messages (but works anyway) if cmp isn't
executable is attached. It is against 2.1.49 pre-patch 1, but it shouldn't
matter.

-=- James Mastros

P.S. -- Yes, I know that the spelling in this mail is terrible. I'm ftping
ispell even as I write this <G>.

---

--- /dev/null Sun Jul 17 19:46:18 1994 +++ linux/scripts/mv-if-changed Sun Aug 10 19:44:15 1997 @@ -0,0 +1,19 @@ +#!/bin/sh + +# Aug 10 1997 - James Mastros (abszero@epix.net) - mv $1 $2, but only if +# cmp $1 $2 reports changes. If cmp is not found, or cannot be executed, +# a mv is always done. This way, a recompile is only done if acatually +# necesary. + +if cmp $1 $2 +then + echo $2 unchanged. +else + echo $2 changed. + mv $1 $2 +fi --- linux/scripts/Configure.flat Sun Aug 10 18:22:06 1997 +++ linux/scripts/Configure Sun Aug 10 20:01:07 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,12 @@ 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~ Sun Aug 10 18:24:40 1997 +++ linux/Makefile Sun Aug 10 20:04:51 1997 @@ -11,6 +11,7 @@ # # NOTE! SMP is experimental. See the file Documentation/SMP.txt # +# Don't set to zero to disable; comment the next line out instead. # SMP = 1 # # SMP profiling options