开发者

How to print #(sharp sign) in a Makefile

Suppose you have a variable which is set as:

AVar = "#"

echo "${AVar}"

The above thing does not outp开发者_开发技巧ut in Makefile when run through make.

# must be escaped but the AVar may not have special chars in its content?

So what can I escape the Avar?


Tested working with GNU Make 3.81 on MacOS X:

AVar = "\#"

foo:
    @echo "${AVar}"

I'm not sure what you mean by "AVar may not have special chars in its content". In this case it's the only way to tell make that the # is part of the string, and not the start of a comment.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜