Let's say I want to compile a C++ project located in /home/me/Google Drive/Foobar/
into an executable named Foobar
, and I want to use GNU Make in order to make that process automatic.
Here is what my Makefile looks like :
OUTPUT = $(notdir $(CURDIR))
all $(OUTPUT):
g++ *.cpp -o $(OUTPUT)
The problem is, since there are spaces in the project's path, the notdir
command is interpreting two separate paths and returns Google Foobar
.
I've tried putting quotes around $(CURDIR)
($(notdir "$(CURDIR)")
) but I get the following error :
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1
I don't understand where the problem comes from.
Also, I would appreciate an answer that does not involve changing the path name... Thanks :)