[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Flexible patsubst (add something in the middle)
From: |
Oleksandr Gavenko |
Subject: |
Re: Flexible patsubst (add something in the middle) |
Date: |
Tue, 06 Apr 2010 11:22:40 +0300 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 |
On 2010.04.03 15:49, Peng Yu wrote:
I want to add something to a number of string in the middle but not at
the ends. I made the following example (doesn't work). Could you
please let me know what is the most convenient to add something to the
middle of a number strings?
.PHONY: all
PDF=uuu/vvv.pdf xxx/yyy.pdf
TMP=$(patsubst %/%.pdf, %abc/%.pdf, $(PDF))
all:
echo $(TMP)
I found solution with using 'word' and 'wordlist'
(note that file MUST lies in same depth):
empty =
space = $(empty) $(empty)
var = dir1/a/b.txt dir2/c/d.txt
newvar = $(foreach item,$(var),$(subst $(space),/,$(wordlist 1,2,$(subst
/,$(space),$(item))))/newdir/$(word 3,$(subst /, ,$(item))))
all:
echo $(newvar)
But any time you can use $(shell sed ......) :)
--
С уважением, Александр Гавенко.