help-make
[Top][All Lists]
Advanced

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

Two uses for .PRECIOUS ?


From: spam-from-help-make
Subject: Two uses for .PRECIOUS ?
Date: Tue, 9 Oct 2001 10:18:39 -0400 (EDT)

Dear Make Experts,

I have a problem with .PRECIOUS - it seems to control two things, but
I only want it to control one of them.  Can anyone suggest a way
around this?  Here's the scenario:

I have two source files, A and X, and I want to make C.  C depends
directly on X, and on A via an intermediate file B:

C: B X
        munge B X > C

B: A
        frob A > B

If I have A and X, when I "make C" it will run frob then munge and
then delete B (*see note).  If I then change X and "make C" again, it will
again run frob and munge.  I don't want it to run frob when A hasn't
changed, so I make B precious:

.PRECIOUS: B

Now, the first time I "make C" it runs frob and munge, but when I
change X only munge is run because it didn't delete B.  Good.

BUT if I change A, and then *press Ctrl-C while frob is running*, I
get a garbled B.

My point is that there are two uses for .PRECIOUS: one is to say
"don't delete this file after the final target has been made if is is
created as an intermediate", and the other is to say "don't delete
this file if the command that is creating it is interrupted".  These
are both controlled by .PRECIOUS, but in my case I want only the first
of them.

Surely I'm not the first to have come across this?  Is there some
other way of controlling what is deleted and when?  This does matter
to me because my "frob" program is quite long-running, and so (a) I
don't want to run it when I don't need to, and (b) I'm quite likely to
interrupt it when I realise that my change to "A" is wrong...

Any observations and suggestions welcome.

[note: checking this through I realise that for the code I've given, B
doesn't actually get deleted; intermediates are only deleted if they
are created to satisfy a pattern rule.  My real code has pattern rules
but this example doesn't.  Please assume that I'm talking about
pattern rules.]

Thanks for your attention.

--Phil Endecott
(p.s. the From: address IS valid)





reply via email to

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