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.