如何在Makefile中用空格替换单引号

时间:2011-01-23 12:01:03

标签: replace makefile

我可以用GNU makefile中的任何其他东西替换任何东西。但无法弄清楚如何用空格替换单引号。 任何帮助!

编辑:我尝试过这样的事情:

$(subst \',:,$(text))

在上面我试图用冒号替换单引号,但它似乎不起作用。

1 个答案:

答案 0 :(得分:2)

似乎按预期工作:

$ cat Makefile
FOO="'"
BAR=$(subst ', :,$(FOO))
BAZ="This 'is 'some 'te'xt' wi't'h in'ter'sper'sed' apo'stro'phe's"
QUX=$(subst ', ,${BAZ})
ARF=$(subst ',:,$(BAZ))

.PHONY: all
all:
        @echo FOO = ${FOO}
        @echo BAR = ${BAR}
        @echo BAZ = ${BAZ}
        @echo QUX = ${QUX}
        @echo ARF = ${ARF}

$ make
FOO = '
BAR =  :
BAZ = This 'is 'some 'te'xt' wi't'h in'ter'sper'sed' apo'stro'phe's
QUX = This  is  some  te xt  wi t h in ter sper sed  apo stro phe s
ARF = This :is :some :te:xt: wi:t:h in:ter:sper:sed: apo:stro:phe:s