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