$(A2): echo test > "$@" $ touch 'a file with spaces' 'yet another file with spaces' $ ls -l total 4 -rw-r--r-- 1 kas kas 0 2010-03-11 09:08 a file with spaces -rw-r--r-- 1 kas kas 156 2010-03-11 09:06 Makefile -rw-r--r-- 1 kas kas 0 2010-03-11 09:08 yet another file with spaces $ make echo test > "a file with spaces.txt" echo test > "yet another file with spaces.txt" $ ls -l total 12 -rw-r--r-- 1 kas kas 0 2010-03-11 09:08 a file with spaces -rw-r--r-- 1 kas kas 5 2010-03-11 09:08 a file with spaces.txt -rw-r--r-- 1 kas kas 156 2010-03-11 09:06 Makefile -rw-r--r-- 1 kas kas 0 2010-03-11 09:08 yet another file with spaces -rw-r--r-- 1 kas kas 5 2010-03-11 09:08 yet another file with spaces.txt
no subject
A1 = $(shell ls *spaces | sed 's| |\\ |g')
A2 = $(subst /,\ ,$(foreach filename,$(subst \ ,/,$(A1)),$(filename).txt))
all: $(A2)
$(A2):
echo test > "$@"
$ touch 'a file with spaces' 'yet another file with spaces'
$ ls -l
total 4
-rw-r--r-- 1 kas kas 0 2010-03-11 09:08 a file with spaces
-rw-r--r-- 1 kas kas 156 2010-03-11 09:06 Makefile
-rw-r--r-- 1 kas kas 0 2010-03-11 09:08 yet another file with spaces
$ make
echo test > "a file with spaces.txt"
echo test > "yet another file with spaces.txt"
$ ls -l
total 12
-rw-r--r-- 1 kas kas 0 2010-03-11 09:08 a file with spaces
-rw-r--r-- 1 kas kas 5 2010-03-11 09:08 a file with spaces.txt
-rw-r--r-- 1 kas kas 156 2010-03-11 09:06 Makefile
-rw-r--r-- 1 kas kas 0 2010-03-11 09:08 yet another file with spaces
-rw-r--r-- 1 kas kas 5 2010-03-11 09:08 yet another file with spaces.txt