[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two uses for .PRECIOUS ?
From: |
Paul D. Smith |
Subject: |
Re: Two uses for .PRECIOUS ? |
Date: |
Tue, 9 Oct 2001 11:48:48 -0400 |
%% address@hidden writes:
s> My point is that there are two uses for .PRECIOUS: one is to say
s> "don't delete this file after the final target has been made if is
s> is created as an intermediate", and the other is to say "don't
s> delete this file if the command that is creating it is
s> interrupted". These are both controlled by .PRECIOUS, but in my
s> case I want only the first of them.
Mentioning a target explicitly _anywhere_ in the makefile is enough to
keep it from being considered an intermediate file, and thus removed.
Maybe you can create a rule which has as prerequisites all the
intermediate files; this rule doesn't have to actually be invoked.
For example, if you have:
TARGETS = foo.x bar.x
.PHONY: all
all: $(TARGETS)
%.x : %.y ; cp $< $@
%.y : %.z ; cp $< $@
$(TARGETS:.x=.z): ; echo > $@
Then you could add another rule like this, just to keep the .y files
from being considered intermediate:
.PHONY: intermediates
intermediates: $(TARGETS:.x=.y)
Who knows, maybe you'll even find that rule handy sometimes :).
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist