help-make
[Top][All Lists]
Advanced

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

Re: Object files automatically deleted by pattern rule


From: Paul Smith
Subject: Re: Object files automatically deleted by pattern rule
Date: Wed, 06 Feb 2008 17:56:18 -0500

On Wed, 2008-02-06 at 17:34 -0500, Adam Lichtl wrote:
> Ah- great!  I was also reading up on .SECONDARY with no
> prerequisites, 
> but I suppose I should be specific and save just my object files with:
> 
> .PRECIOUS: %.o

Note that all you HAVE to do is mention the file you want to preserve
SOMEWHERE in the makefile, as a target _or_ prerequisite.

As soon as you do that, even if that rule is never used for anything,
the target won't be deleted.

.PRECIOUS is not exactly what you want, I think, because it says too
much.  Not only will it preserve the target on exit, but it will ALSO
preserve the target if make is interrupted or whatever.  This can lead
to incorrect builds, because the target will only be half-created but
since it exists and has a new timestamp, make won't try to recreate it.
Depending on the type of target and what you do with it, the failure
caused by this could be very subtle.

YMMV.

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <address@hidden>                 http://make.mad-scientist.us
 "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]