bug-make
[Top][All Lists]
Advanced

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

[bug #60799] Parser chokes on second expansion of a prerequisite with ;


From: Paul D. Smith
Subject: [bug #60799] Parser chokes on second expansion of a prerequisite with ; o #
Date: Sat, 19 Jun 2021 10:22:13 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36

Follow-up Comment #2, bug #60799 (project make):

I will look at the fix but I'm not sure I want to try to work around this.  If
"$$" appears in the prerequisite list then it's not special to make... this is
true regardless of whether second expansion is enabled or not.

As with all special characters the best way to mask them is by hiding them in
a variable:


$ cat Makefile
sem = ;
hash = \#

.SECONDEXPANSION:
all: who $$(shell echo hi 1>&2 $(sem) echo there 1>&2);@:
who: $$(shell echo 'hi $(hash) there' 1>&2);@:

$ make
hi
there
hi # there


Or of course you could put the entire thing in a variable which is even
simpler/cleaner:


$ cat Makefile
sem = $(shell echo hi 1>&2 ; echo there 1>&2)
hash = $(shell echo 'hi # there' 1>&2)

.SECONDEXPANSION:

all: who $$(sem);@:
who: $$(hash);@:

$ make
hi
there
hi # there


I'll need to think about whether adding more special casing to try to
recognize and manage variables/functions targeted at secondary expansion is
going to cause other issues.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60799>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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