开发者

How to replace single-quote by space in a Makefile

I am able to replace anything with anything else in a GNU makefile. But can't work out how to replace single-quote with spaces. Any help!

EDIT: I have tried something like this:

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

In above I am trying to re开发者_Python百科place single-quotes with colons, but it doesn't seem to work.


Seems to work as expected:

$ 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜