On Fri, 2024-10-11 at 09:45 +0000, Edward Welbourne wrote:
> Paul Smith (10 October 2024 17:56) wrote:
> > .PRECIOUS is dangerous and should almost never be needed or used. 
> 
> This danger can be avoided by having a recipe (or the command it
> runs) generate the new file under an alternative name and finish up,
> on success, by doing a rename to replace the old version.

Yes for sure.  But, I wonder why go to the trouble when it's even
simpler to just not use .PRECIOUS in the first place :).

Of course there are still situations where make can't clean up: if it's
killed via -9 (SIGKILL) instead of SIGINT for example, so "defensive
makefile recipes" can still be a good idea if you are trying to create
a truly bullet-proof build system (maybe for a hands-off CI
implementation).

As you point out, though, it requires cooperation on the part of the
tools make is invoking.

Reply via email to