|
From: | Yair Lenga |
Subject: | Create "If Different" dependency |
Date: | Wed, 22 Jan 2003 12:20:40 -0500 |
User-agent: | Mozilla/5.0 (X11; U; IRIX64 IP30; en-US; rv:1.1) Gecko/20021001 |
Hi,I have to setup a makefile rules that will update the target if the source is different from the target. Ideally, I will write
target: source cp $< $@Unfortunanly, this does not work for me. First, the target might be modified by other processes. The other problem is that the "make" is being executed on different machines, which may have "time drift" - making timestamps fail sometimes. My best solution is:
.PHONY: FORCE target: FORCE cmp -s source target || cp source $@This approach takes a lot of CPU, and network bandwidth (I'm using NFS). Does anyone has better solution ? Some packages offer MD5 instead/in addition to timestamping. Can this appraoch be applied with gnu-make ?
Thanks Yair Lenga
[Prev in Thread] | Current Thread | [Next in Thread] |