Re: say which of .PRECIOUS: %.o *.o file.o will actually work
From:
Dmitry Goncharov
Subject:
Re: say which of .PRECIOUS: %.o *.o file.o will actually work
Date:
Thu, 10 Oct 2024 11:45:24 -0400
On Thursday, October 10, 2024, Britton Kerin <britton.kerin@gmail.com> wrote: > On Wed, Oct 9, 2024 at 4:01 PM Dmitry Goncharov <dgoncharov@users.sf.net> wrote: >> >> On Tue, Oct 8, 2024 at 11:16 PM Dan Jacobson <jidanni@jidanni.org> wrote: >> > >> > Manual says: >> > >> > You can list the target pattern of an implicit rule (such as '%.o') >> > as a prerequisite of the special target '.PRECIOUS' to preserve >> > intermediate files made by implicit rules whose target patterns match >> > that file's name; see *note Interrupts::. >> > >> > Well say which of >> > .PRECIOUS: %.o >> > .PRECIOUS: *.o >> > .PRECIOUS: file.o >> > will actually work. >> > >> > The words above make the reader think they should use the first form. >> > >> > But in my experiments, only this last one works. >> >> .PRECIOUS: %.o has the desired effect when a related implicit rule is used. >> For example, the following marks hello.x and hello.q as precious. >> >> .PRECIOUS: %.x %.q >> all: hello.x >> %.x: %.q; $(info $@ from $<) >> %.q:; > > Does this work for static patterns also?
Use of patterns to mark files precious has effect only if a related implicit rule is used. There is little benefit to mark files built by static pattern rules precious, because static pattern rules do not build intermediate files.