Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2013 16:10:00 -0700
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        Johan Kuuse <kuuse@redantigua.com>
Cc:        freebsd-doc@freebsd.org, sjg@juniper.net
Subject:   Re: FreeBSD Make question
Message-ID:  <20131025231000.C74665807E@chaos.jnpr.net>
In-Reply-To: <CAGUU1d3ExyGrqGo1K8ta2qB=iwsU=ivgZUv3k3swbg-TRjtPzA@mail.gmail.com>
References:  <CAGUU1d1RQAuq=5rOczZnRnVo31Rh_xhYOnDP7-=ajVv4AnRwZA@mail.gmail.com> <alpine.GSO.1.10.1310241730590.4934@multics.mit.edu> <20131024214923.CB0AF5807E@chaos.jnpr.net> <CAGUU1d0DVRYO_GUryyJONbpTgxrsYFf=WeQkn63557stnpsaVQ@mail.gmail.com> <20131025174720.870B35807E@chaos.jnpr.net> <CAGUU1d3ExyGrqGo1K8ta2qB=iwsU=ivgZUv3k3swbg-TRjtPzA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>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
$





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131025231000.C74665807E>