bug-make
[Top][All Lists]
Advanced

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

Re: Possible bug: Intermediate file deletion using pattern rules with m


From: Johan Bezem
Subject: Re: Possible bug: Intermediate file deletion using pattern rules with multiple targets
Date: Mon, 29 Apr 2002 08:24:24 +0200

Hi,

since I didn't get any reaction at all, neither in this mailing list nor at the 
bug report I created at 'savannah', I'd like to resubmit. Paul possibly has 
seen this problem before, and may even have a patch available; reports of 
reproducibility from other platforms might also help narrow down where to look.
I all doesn't help, I'll have to dig down the code. I know it's not a major 
issue here, but I need consistent behavior in my makefiles, either way.

Thanks again,

Johan Bezem
CSK Software AG

Johan Bezem wrote:
> 
> Hi,
> 
> using make 3.79.1 on multiple platforms, I've discovered a bahavior of make 
> that I cannot explain:
> When intermediates are created using a pattern rule with multiple targets, 
> only the first (intermediate) target to be created is deleted after the 
> processing has ended.
> As an example, I have a 'file.input' with arbitrary contents, and I'm using 
> the following makefile:
> 
> # The next line can be a workaround in some cases
> # but no wildcard like %.int is allowed
> #.INTERMEDIATE: file.int file-nodelete.int
> 
> all: file.out file-nodelete.out
> 
> %.out: %.int
>         cat $< > $@
> 
> %-nodelete.int %.int: %.input
>         echo "intfile, target $(subst -nodelete,,$*).int" > $(subst 
> -nodelete,,$*).int
>         echo "intfile nodelete, target $(subst -nodelete,,$*)-nodelete.int" > 
> $(subst -nodelete,,$*)-nodelete.int
> 
> clean:
>         rm -f *.int *.out
> 
> The two 'echo' lines will possibly get mangled by my/your mail client, but I 
> hope the intention is clear.
> Since 'file.out' is the first prerequisite of target 'all', the intermediate 
> 'file.int' is created first, but the commands for it also create 
> 'file-nodelete.int' in the process. The commands are - correctly - executed 
> only once.
> Now, if 'file-nodelete.out' would not be a prerequisite of all, 
> 'file-nodelete.int' would arguably not be deleted afterwards, possibly since 
> make doesn't retain any knowledge about files it doesn't need.
> However, since 'file-nodelete.int' is a required intermediate file, I would 
> expect it to be deleted after the process, just like 'file.int' is. The 
> output of running make, however, reads like this:
> 
> [jbezem] darkstar:TmpTest/$ make -f Makefile-indirect
> echo "intfile, target file.int" > file.int
> echo "intfile nodelete, target file-nodelete.int" > file-nodelete.int
> cat file.int > file.out
> rm file.int
> 
> I've tested this both on Windows NT4, using CygWin 1.3.10, make 3.79.1-5, and 
> on Solaris 2.7, make 3.79.1.
> The inclusion of the special target name '.INTERMEDIATE' for all *.int files 
> induces make to delete both files, however, wildcards are not supported... I 
> couldn't find anything in the archives or the manual, either.
> 
> Is this a true bug, or can someone teach me how to RTFM?
> 
> Ciao,
> 
> Johan Bezem
> CSK Software AG



reply via email to

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