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 ......)  :)

--
С уважением, Александр Гавенко.


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to