/tmp/foo\$bar.mk mak...">

How to stop GNU from expanding dollar signs in MAKEFILE_LIST?

Running

echo -e "all:\n\techo '\$(value MAKEFILE_LIST)'" > /tmp/foo\$bar.mk
make -f /tmp/foo\$bar.mk

      

will print

echo ' /tmp/fooar.mk'
/tmp/fooar.mk

      

From this we can see what MAKEFILE_LIST

contains the extended filenames.

How can I get the correct Makefile name (including dollar signs)?

My version is GNU Make 4.2.1.

My motivation: The dollar signs are actually part of the path to my Makefile. I cannot rename this path because it comes from the Samba share that people who will run make should use.

Update

Filed upstream as http://savannah.gnu.org/bugs/?50823 .

Update

The proposed patch is available at https://savannah.gnu.org/bugs/?50823#comment1 .

+3


source to share


1 answer


This is a hack, but anyway: you can define a make variable b=$$b

:

$ cat '/tmp/foo$bar.mk'
all:
        echo '$(value MAKEFILE_LIST)'
$ gmake -f /tmp/foo\$bar.mk b='$$b'
echo ' /tmp/foo$bar.mk'
 /tmp/foo$bar.mk

      



It does not hinder expansion, but it does efficient expansion without surgery.

+1


source







All Articles