bug-make
[Top][All Lists]
Advanced

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

Re: say which of .PRECIOUS: %.o *.o file.o will actually work


From: Paul Smith
Subject: Re: say which of .PRECIOUS: %.o *.o file.o will actually work
Date: Thu, 10 Oct 2024 11:56:06 -0400
User-agent: Evolution 3.52.4 (by Flathub.org)

On Thu, 2024-10-10 at 11:45 -0400, Dmitry Goncharov wrote:
> There is little benefit to mark files built by static pattern rules
> precious,  because static pattern rules do not build intermediate
> files.

It's a mistake to consider .PRECIOUS in the context of intermediate
files.  This is a common misunderstanding that, unlike globbing
expressions for example, probably DOES deserve some changes to the
manual to make clear.

.PRECIOUS is dangerous and should almost never be needed or used.  Its
goal is to prevent make from deleting files automatically when a recipe
fails (for any reason).  There are very few, very rare situations where
this is what you want, because it means that if (for example) the user
uses ^C to kill a build and the recipe leaves a half-constructed target
file behind your build will start to fail until you go delete it by
hand.  I have a hard time even imagining a good reason to use it.


If you want to avoid a target being marked intermediate there are
other, better ways to do that (use .SECONDARY or even just mention the
target as a prerequisite of some rule, somewhere).

.PRECIOUS is a very wrong solution to the intermediate situation.



reply via email to

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