help-make
[Top][All Lists]
Advanced

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

Rules with multiple outputs and intermediate chains


From: Lane Schwartz
Subject: Rules with multiple outputs and intermediate chains
Date: Wed, 22 Dec 2010 12:13:53 -0500

I am trying to solve an issue involving a pattern rule with multiple output
files, where the output files should be intermediate. In the case below, if
both output files from a pattern rule are later used as prerequisites, only
the first one will be treated as intermediate.

The steps to reproduce are below.

Expected result of make all: foo.jkl is created, and all other files are
created then deleted
Actual result of make all: foo.jkl is created; foo.abc, foo.def, and foo.ghi
are created; foo.abc and foo.def are deleted; foo.ghi is NOT deleted

all: foo.jkl



%.abc:

 date > $@



%.def %.ghi: %.abc

 @echo "Generating $*.def and $*.ghi from $*.abc"

 @sleep 2

 @touch $*.def $*.ghi



%.jkl: %.def %.ghi

 cat $^ > $@

 clean:

 rm -f *.*





Adding the following line does not appear to change make's behavior:



.INTERMEDIATE: %.ghi





When I change the makefile such that the pattern rule that creates %.def and
%.ghi is created through the use of a template and $(eval $(call
MY_TEMPLATE)) as in section 8.8 of the GNU Make Manual, neither foo.def nor
foo.ghi are deleted.



This behavior seems to be inconsistent with the description of how implicit
chains should be handled (in section 10.4 of the manual).



I'd appreciate any advice, as well as confirmation on whether or not this
behavior should be expected.



Thanks,

Lane


reply via email to

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