You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using "clang -MMD" with filenames that contain dollar signs, the dollar signs are not escaped. If this output is used with make it won't be able to find the prerequisites. For example:
$ make CC=gcc
gcc -MMD -c main.c
$ cat main.d
main.o: main.c dollar$$sign.h
$ make CC=gcc
make: `main.o' is up to date.
$ make clean
fails with clang (once .d file has been created)
$ make CC=clang
clang -MMD -c main.c
$ cat main.d
main.o: main.c dollar$sign.h
$ make CC=clang
make: *** No rule to make target dollarign.h', needed by main.o'. Stop.
Since the dollar sign is not doubled, make tries to expand "$s" and gets an empty string making it think the desired filename is "dollarign.h". Since that file doesn't exist, the make then fails.
The text was updated successfully, but these errors were encountered:
Extended Description
When using "clang -MMD" with filenames that contain dollar signs, the dollar signs are not escaped. If this output is used with make it won't be able to find the prerequisites. For example:
$ /bin/ls -l
-rw-r--r-- 1 abbeyj users 75 Apr 1 17:36 Makefile
-rw-r--r-- 1 abbeyj users 0 Apr 1 17:35 dollar$sign.h
-rw-r--r-- 1 abbeyj users 25 Apr 1 17:32 main.c
$ cat Makefile
main.o: main.c
$(CC) -MMD -c main.c
-include main.d
clean:
$(RM) *.o *.d
$ cat main.c
#include "dollar$sign.h"
works fine with gcc
$ make CC=gcc
gcc -MMD -c main.c
$ cat main.d
main.o: main.c dollar$$sign.h
$ make CC=gcc
make: `main.o' is up to date.
$ make clean
fails with clang (once .d file has been created)
$ make CC=clang
clang -MMD -c main.c
$ cat main.d
main.o: main.c dollar$sign.h
$ make CC=clang
make: *** No rule to make target
dollarign.h', needed by
main.o'. Stop.Since the dollar sign is not doubled, make tries to expand "$s" and gets an empty string making it think the desired filename is "dollarign.h". Since that file doesn't exist, the make then fails.
The text was updated successfully, but these errors were encountered: