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

 
 

bug #32042: Rules with multiple outputs and intermediate chains

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

Add a New Comment Rich Markup
   

Sun 08 Jan 2023 07:09:56 PM UTC, comment #2: 

This appears to be working correctly as of GNU make 4.4.

Paul D. Smith <psmith>
Group administrator
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>
Group 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

%.abc:
date > $@

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

%.jkl: %.def %.ghi
cat $^ > $@
clean:
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).


Anonymous

 

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

Attach Files:
   
   
Comment:
   

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-08 psmith Open/ClosedOpen Closed
    2023-01-08 psmith StatusNone Fixed
        Assigned toNone psmith
        Component VersionNone 3.82
        Fixed ReleaseNone 4.4
    2012-09-10 psmith Triage StatusNone Medium Effort

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code