[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .PRECIOUS for intermediates without keeping corrupt files?
From: |
John Graham-Cumming |
Subject: |
Re: .PRECIOUS for intermediates without keeping corrupt files? |
Date: |
Sat, 01 Jan 2005 11:34:39 -0500 |
On Fri, 2004-12-31 at 17:13, Wagman, Adam wrote:
> The GNU Make documentation says that .PRECIOUS is used for two
> distinct purposes: 1) to prevent intermediate targets from being
> deleted, and 2) to prevent deleting targets if make is interrupted
> (e.g. via ctrl-C).
>
> Is there any way to get just #1 without #2? My particular case is
> that an EXE depends on several .obj files, so that making the exe
> causes the .c/.cpp files to be compiled to the .objs, and I want to
> keep those .obj files to keep from remaking them. However, if the
> make is interrupted, I certainly don't want corrupt .obj files left
> lying around, waiting to be linked and cause problems.
Take a look at the .SECONDARY: target. This will mark an intermediate
target (your .objs) as both intermediate and kind-of-PRECIOUS. The
file will get deleted if you abort make, but wont get deleted like an
intermediate would.
>From the Make manual:
"You can prevent automatic deletion of an intermediate file by
marking it as a "secondary" file. To do this, list it as a
prerequisite of the special target `.SECONDARY'. When a file is
secondary, `make' will not create the file merely because it does not
already exist, but `make' does not automatically delete the file.
Marking a file as secondary also marks it as intermediate."
John.
--
John Graham-Cumming
Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: .PRECIOUS for intermediates without keeping corrupt files?,
John Graham-Cumming <=