bug-make
[Top][All Lists]
Advanced

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

[bug #51414] Use of multiple $$% (for .SECONDEXPANSION) causes make to m


From: Paul D. Smith
Subject: [bug #51414] Use of multiple $$% (for .SECONDEXPANSION) causes make to misinterpret the rule as a pattern rule
Date: Sun, 9 Jul 2017 17:26:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

Update of bug #51414 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Actually what's happening is that your rule is being misinterpreted as a
static pattern rule, not a pattern rule, and it's not because you are using
$$%, it's because you are using a substitution reference in a secondary
expansion.  Also it doesn't matter how many uses of "$$%" you use; even one
substitution reference will show this problem.

Because you have used "$$" in the prerequisites list, make doesn't interpret
this as a variable reference.  That means the open parenthesis is not part of
a variable reference and has no special meaning to make.  So when make sees
this:


blahblah : $$(%:blah)


it tokenizes this string as "blahblah", ":", "$$(%", ":", "blah)".  The ":" IS
a special character to make, it's a rule separator.  When make sees a word
containing the special character "%" between two ":" characters it interprets
this to be a static pattern rule.  Because the "target" doesn't match the
pattern, you get this error.

I don't see any way to solve this problem: the grammar here is simply
ambiguous and make can't know what you mean.

In order to do what you want you cannot use a substitution reference
(directly) because of the ":" character in it.  You can either use a patsubst
function:


.SECONDEXPANSION:

libmy.a(my_source.o): $$(patsubst %_source.o,%,$$%)_internal.h


(here there's no ":" in the prereq list so it works).  Or you can use a
variable to hide the ":" and ensure that make parses things correctly:


nosource = $$(%:_source.o=)

.SECONDEXPANSION:

libmy.a(my_source.o): $$(nosource)_internal.h


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51414>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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