Subject: Re: install-if-change?
To: None <current-users@NetBSD.ORG>
From: Christos Zoulas <>
List: current-users
Date: 07/07/1996 00:31:52
In article <Pine.BSD/> (NetBSD) writes:
>On Sat, 6 Jul 1996, VaX#n8 wrote:
>> Has anyone written  a script like this that invokes the install
>> program only if the source contents != the target contents.
>> Does anyone think this would/wouldn't be a good patch to the install program?
>> I think this is a fairly common idiom and useful in both build environments,
>> as well as mtree/tripwire-style systems (the two environs I can think of
>> that really use mtimes).
>> I've written (well, stolen) "cp-if-change" and "mv-if-change" from some
>> GNU tools.  Trivial scripts, really, but they don't have the full
>> capabilities of their /bin counterparts (can't cp multiple files into
>> a dir, etc).
>FreeBSD has implemented this as install -C (capital C) which copies the 
>new file only if it is different from the existing one.

I'd like to see is make rules that check if the target is newer.

e.g. in could be written as:

.if !target(realinstall)
.if defined(PROG)
.if !defined(FORCE)
realinstall:	${DESTDIR}${BINDIR}/${PROG}

	install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
Basically the above (if FORCE is not defined) installs only if the program
is newer than the target. This avoids the problem where each 'make install'
installs new binaries. I think that there is a place for install -C, but
unfortunately install -C does not show me when the target has actually been