http://kiryl.livejournal.com/ ([identity profile] kiryl.livejournal.com) wrote in [personal profile] metaclass 2010-03-11 07:10 am (UTC)

$ cat Makefile
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

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting