delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/06/09:40:16

X-Authentication-Warning: kendall.sfbr.org: jeffw set sender to jeffw AT darwin DOT sfbr DOT org using -f
Date: Wed, 6 Jun 2001 08:42:02 -0500
From: JT Williams <jeffw AT darwin DOT sfbr DOT org>
To: djgpp AT delorie DOT com
Subject: portable equivalent to djgpp `update'
Message-ID: <20010606084202.A18502@kendall.sfbr.org>
Mail-Followup-To: djgpp AT delorie DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
Reply-To: djgpp AT delorie DOT com

I've found the djgpp utility `update' very useful in makefiles for
validating (and updating, if necessary) a local copy of some master
data file (which never changes) prior to `regression' testing:

foo.dat:	/path/to/sacred/foo.dat
		update $^ $@


What is a portable (if inefficient or inelegant) replacement for `update'?
I suppose an unconditional `cp -f' is ok, or maybe something like this
(just off the top of my head, might be insane):

foo.dat:	/path/to/sacred/foo.dat
		[ -f $@ ] && cmp -s $< $@ || cp -f $< $@
		touch $@

The `touch' updates the timestamp on the local copy in the event `cp'
might have been aliased to `cp -p'
-- 
TIA/jtw

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019