GNU Make does very poorly with names separated by spaces.
Spaces are used as delimiters in the list of words everywhere.
This blog post describes the situation well, but WARNING: it doesnโt use \\ correctly, not \
target: some\ file some\ other\ file some\ file some\ other\ file: echo done
You can also use variables, so this will also work
VAR := some\ file some\ other\ file target: $(VAR) $(VAR): echo done
Only the wildcard function recognizes shielding, so you cannot do anything without pain.
But don't forget that your shell also uses spaces as delimiters. .
If I wanted to change echo done to touch $@ , I would have to add a slash to avoid it for my shell.
VAR := some\ file target: $(VAR) $(VAR): touch $(subst \,\\,$@)
or more likely to use quotation marks
VAR := some\ file some\ other\ file target: $(VAR) $(VAR): touch '$@'
After all, if you want to avoid much pain, both in GNU make and in your shell, do not put spaces in the file names. If you do, we hope that the limited features of Make will be sufficient.
Paul Draper May 24 '14 at 21:10 2014-05-24 21:10
source share