我可以用GNU makefile中的任何其他东西替换任何东西。但无法弄清楚如何用空格替换单引号。 任何帮助!
编辑:我尝试过这样的事情:
$(subst \',:,$(text))
在上面我试图用冒号替换单引号,但它似乎不起作用。
答案 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