help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make always builds, part 2


From: Paul Smith
Subject: Re: make always builds, part 2
Date: Tue, 15 Nov 2011 08:32:05 -0500

On Tue, 2011-11-15 at 08:22 -0500, David Boyce wrote:
> On Tue, Nov 15, 2011 at 7:53 AM, Paul Smith <address@hidden> wrote:
> >        __dummy := $(shell mkdir $(OBJDIRECTORY))
> 
> Generally best here (again, assuming POSIX) to use mkdir -p which does
> not fail if the directory already exists.

Yes but I don't know if there's an equivalent in Windows.  If not
redirect stderr to /dev/null (or the equivalent in Windows).

> > Second, you can create it as a side-effect of every target that 
> > needs it (in the script for that target).
> 
> This is not parallel-safe because two recipes building unrelated
> targets in the same directory might run mkdir at the same time.

I think it's parallel-safe.  Everything is serialized at the filesystem
level anyway; it won't corrupt your filesystem or anything to run mkdir
multiple times concurrently.  One of the mkdirs will succeed and the
others will not but either way you'll have a directory created.

OO prereqs are definitely the most "correct" way but older versions of
GNU make don't support that feature.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]