google / kati

An experimental GNU make clone
Apache License 2.0
941 stars 111 forks source link

Expression Parser: Retain single '$' signs before terminators #224

Closed metti closed 3 years ago

metti commented 3 years ago

Single dollar signs without variable reference are treated as literal dollar signs by GNU Make if they are before a terminator, such as a line ending or a comma in a function argument list. Let Kati do the same.

Consider the following Makefile

foo := $(subst a,$,bab)
test:
    echo $(foo)

foo expands to b$b by replacing occurrences of 'a' by the literal '$'. The command effective is then echo b$b, printing just 'b' unless $b evaluates to something.

There was a test failing due to this missing corner case implementation that is now fixed as well: testcase/subst2.mk Further I added an explicit test case: testcase/simple_subst.mk to preserve this corner case.