help-make
[Top][All Lists]
Advanced

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

Re: Why is make not deleting intermediate files?


From: Philip Guenther
Subject: Re: Why is make not deleting intermediate files?
Date: Thu, 19 Jan 2012 15:17:01 -0800

On Thu, Jan 19, 2012 at 2:48 PM, Reece Hart <address@hidden> wrote:
> make is not deleting intermediate files when the dependency appears in
> more than one rule. This occurs even when I explicitly declare the
> intermediate file as such using .INTERMEDIATE with a pattern, the
> literal filename, or both.
...
> The Makefile as posted gives:
>
> snafu$ rm -f once* twice*; make oncetwice
> oncetwice: once twice
> rm once.dep twice.dep
>
> Uncommenting the twice: twice.dep line:
>
> snafu$ rm -f once* twice*; make oncetwice
> oncetwice: once twice
> rm once.dep
>
> Notice that `twice.dep' is not rm'd in the second invocation.
...
> I've tried: 1) making `another: twice.dep' a rule with a command
> block; 2) variations of specifying .INTERMEDIATE as a pattern, a
> literal filename, and both; 3) using .PHONY; 4) browsing make-3.82
> NEWS for relevant fixes.

The .INTERMEDIATE target doesn't take patterns, only targets.
(.PRECIOUS takes patterns...and that's explicitly called out in the
description of .PRECIOUS.)  So, your variation (2) "specifying
.INTERMEDIATE as [...] a literal filename" should have worked.
Indeed, that option works for me:

$ grep INTER Makefile
## the following .INTERMEDIATE has no effect re: the twice: twice.dep
.INTERMEDIATE: twice.dep
$ rm -f once* twice*; make oncetwice
oncetwice: once twice
rm once.dep twice.dep
$

Testing with an old make-3.81 binary however it doesn't work:

$ rm -f once* twice*; ~/src/make-3.81/make oncetwice
oncetwice: once twice
rm once.dep
$

So, looks like this was a bug that was fixed in 3.82, perhaps as a
side-effect of some other fix.  Time to upgrade!


Philip Guenther



reply via email to

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