help-make
[Top][All Lists]
Advanced

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

Re: Intermediate files are not being rebuilt


From: John Graham-Cumming
Subject: Re: Intermediate files are not being rebuilt
Date: Thu, 27 Jan 2005 10:00:57 -0500

On Thu, 2005-01-27 at 09:16, Simon De Groot wrote:
> .SECONDARY :
> all : top
> sub% : subsub%
>         @echo Making $@
>         @touch $@
> t%p : sub1 sub2
>         @echo Making $@
>         @touch $@
> clean :
>         rm sub1 sub2 top

[snip]

> csh> rm sub1
> csh> make
> make: Nothing to be done for `all'.
> 
> Without the .SECONDARY target, sub1 and sub2 are deleted altogether
> after each run.
> 
> I'm not used to this behavior when I was using Solaris' make. Is there
> a way to enforce that prerequisites are forced to be rebuilt?

So GNU Make isn't remaking sub1 because it thinks that it doesn't need
to.  That's because now 'top' is newer than subsub1 and subsub2 and so
there's no need to go through the chain of rules and rebuild top.

You can get the behaviour that you are looking for by marking sub1 and
sub2 as PRECIOUS targets.  They will not be deleted and GNU Make will
rebuild them if they are missing.

You can write:

    .PRECIOUS: sub1 sub2

instead of .SECONDARY.  IIRC isn't .PRECIOUS also a Sun Make directive
(i.e. there is no .SECONDARY in Sun Make)?

John.
-- 
John Graham-Cumming

Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/






reply via email to

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