Subject: Re: unique id for makefile target
To: None <netbsd-users@netbsd.org>
From: George Georgalis <george@galis.org>
List: netbsd-users
Date: 01/26/2007 16:38:16
On Fri, Jan 26, 2007 at 11:45:58AM -0800, Chuck Swiger wrote:
>On Jan 26, 2007, at 11:25 AM, George Georgalis wrote:
>>I'm developing a makefile target that does some
>>administrative tasks.  Some targets modify /etc
>>files. I'd like to generate a unique id when I make
>>the target, so on it's completion, we can check for
>>any files that have changed.
>>
>>If this was shell, I'd use something like
>>
>> 	lock=/tmp/${0}-$$ ; [ -e "$lock"] || touch $lock
>
>You almost certainly don't actually want to generate a lockfile where  
>the name changes based on the PID of the make process, because this  
>does nothing to guard against two or more people running this  
>makefile at the same time, and blowing away each others changes.   
>Instead, create a lockfile using a known path, and put the PID of the  
>make process into it, so that you can detect stale locks (see whether  
>that PID exists, and is a make process if you want to get fancy)....

understood. thanks.

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><