Mail Archives: djgpp/2001/06/06/09:40:16
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 -