bugmake - Bugs: bug #16531, Substitution reference and...

 
 

bug #16531: Substitution reference and secondary expansion

Submitter:  None
Submitted:  Fri 05 May 2006 03:36:39 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 04 Mar 2012 03:26:51 PM UTC, comment #4: 

I think the original description is not a bug.  As I said in my comment #3, because make is not parsing the contents of the parens as a variable reference (because we've escaped it), it's treating the ":" as a special character.  I think this is just the behavior we have to accept: ":" is a special character to make, just like "$" and "%" (in some contexts) so it needs to be escaped sometimes.  This is not always obvious but I don't see any way to make it better.

The separate issue, that escaping the colon causes problems, will be addressed by bug #16545.

Paul D. Smith <psmith>
Group administrator
Sun 07 May 2006 06:57:37 PM UTC, comment #3: 

The OP is correct: it's not the "%", it's the ":".  Because the variable reference is escaped, make doesn't skip over it when parsing the command line like it normally would, and instead make sees the second ":" inside the substitution reference and interprets the command as a static pattern rule (any command with two colons on the line is interpreted that way).

I tried to escape the ":" with a backslash and got a core dump (!) which I've reported as bug #16545.

Paul D. Smith <psmith>
Group administrator
Sun 07 May 2006 07:28:36 AM UTC, comment #2: 


> GNU make gets confused by the % in your patsubst call.

The secondary expansion of GNU make is not that much bad. The
putsubst call works perfect without any kind of workarounds.

What the problem is "substitution reference".


.PHONY: foo.bar
.SECONDEXPANSION:
foo: $$(@:%=%.bar); @echo $^
--------
Makefile:3: * target pattern contains no `%'.  Stop.

Anonymous
Fri 05 May 2006 07:09:45 PM UTC, comment #1: 

GNU make gets confused by the % in your patsubst call. You will need to add an indirection:

.PHONY: foo.bar
.SECONDEXPANSION:
p := %
foo: $$(patsubst $p,$p.bar,$$@); @echo $^

Boris Kolpackov <bosk>
Group Member
Fri 05 May 2006 03:36:39 PM UTC, original submission:  

The make doesn't recognize substitution references while the
secondary expansion. I don't find any restrictive note about
this in the manual either.


--------
.PHONY: foo.bar

.SECONDEXPANSION:
#foo: $$(patsubst %,%.bar,$$@)
foo: $$(@:%=%.bar)
\t@echo $^
--------
Makefile:5: * target pattern contains no `%'.  Stop.

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-04 psmith StatusNone Not A Bug
        Assigned toNone psmith
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.14-2340.
    Corresponding source code