FreeBSD Make question
Simon J. Gerraty
sjg at juniper.net
Fri Oct 25 23:25:24 UTC 2013
>Johan:
>Can you give an example of such a (glob chars) substitution?
>May it be similar to, or better than, my ugly hack (see below)?
Doesn't really help.
Eg.
--------------------8<--------------------
TLIST = "/tmp/dir with space/one" "/tmp/another spacey thing/two"
tlist=
.for t in ${TLIST}
tlist+= ${t:tW:S, ,?,g:S,",,g}
# the above :tW causes the value to be treated as one-word
.endfor
all:
@echo TLIST='${TLIST}'
@echo tlist='${tlist}'
--------------------8<--------------------
$ make
TLIST="/tmp/dir with space/one" "/tmp/another spacey thing/two"
tlist= /tmp/dir?with?space/one /tmp/another?spacey?thing/two
$
but when we try to use ${tlist} as targets:
--------------------8<--------------------
TLIST = "/tmp/dir with space/one" "/tmp/another spacey thing/two"
tlist=
.for t in ${TLIST}
tlist+= ${t:tW:S, ,?,g:S,",,g}
.endfor
all: ${tlist}
@echo TLIST='${TLIST}'
@echo tlist='${tlist}'
${tlist}: .PHONY
@echo "making: '$@'"
--------------------8<--------------------
$ make
TLIST="/tmp/dir with space/one" "/tmp/another spacey thing/two"
tlist= /tmp/dir?with?space/one /tmp/another?spacey?thing/two
$
note we don't get 'making...'
If we replace ? with . it works but that isn't very useful:
all: ${tlist:S,?,.,g}
@echo TLIST='${TLIST}'
@echo tlist='${tlist}'
${tlist:S,?,.,g}: .PHONY
@echo "making: '$@'"
$ make
making: '/tmp/dir.with.space/one'
making: '/tmp/another.spacey.thing/two'
TLIST="/tmp/dir with space/one" "/tmp/another spacey thing/two"
tlist= /tmp/dir?with?space/one /tmp/another?spacey?thing/two
$
More information about the freebsd-doc
mailing list