bugmake - Bugs: bug #32042, Rules with multiple outputs and...


bug #32042: Rules with multiple outputs and intermediate chains

Submitted by:  None
Submitted on:  Mon 03 Jan 2011 07:32:15 PM UTC  
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  Medium Effort

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 10 Sep 2012 05:46:23 AM UTC, comment #1: 

I agree this is a bug.  I think fixing it will not be so simple; by the time we are setting the intermediate flag on foo.def, foo.ghi has already been defined as a target and at that point we can't tell whether it was done as a side-effect of the pattern, or whether there really IS an explicit target foo.ghi in the makefile (and so we shouldn't mark it intermediate).  We'll need to find a way to make that distinction.

FYI, the formatting caused problems with your example; here's the makefile I used to test:

all: foo.jkl

%.jkl: %.def %.ghi ; cat '$^' > '$@'

%.def %.ghi: %.abc
        @echo "Generating $*.def and $*.ghi from $<"
        @sleep 2
        touch '$*.def' '$*.ghi'

%.abc: ; date > '$@'

clean: ; rm -f foo.*

Paul D. Smith <psmith>
Project Administrator
Mon 03 Jan 2011 07:32:15 PM UTC, original submission:  

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

date > $@

%.def %.ghi: %.abc
@echo "Generating $*.def and $*.ghi from $*.abc"
@sleep 2
@touch $*.def $*.ghi

%.jkl: %.def %.ghi
cat $^ > $@
rm -f .


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).



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-10 psmith Triage StatusNone => Medium Effort

    Back to the top

    Powered by Savane 3.5