如何在Makefile中注释一行? [英] How to comment a line in a Makefile?
本文介绍了如何在Makefile中注释一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个makefile文件中,我有一些变量.为了更好的理解,我添加了一些评论:
Within a makefile I have a some variables. For a better understanding I added some comments:
variable1 = value1 #A comment
variable2 = true #can be set true or false
variable3 = foo #can be foo or bar
现在的问题是,变量包含给定的文本 ,以及文本和#
之间的所有空格.简单回显的输出显示了问题:
The problem is now, that the variables contain the given text and all spaces between the text and the #
. The output of a simple echo shows the problem:
echo "$(variable1) $(variable2) endOfEcho"
value1 true endOfEcho
如何避免将空格解释为变量的文本?
How to avoid the spaces to be interpreted as variable's text?
推荐答案
使用GNU make:
With GNU make:
@echo "$(strip $(variable1)) $(strip $(variable2)) endOfEcho"
value1 true endOfEcho
@echo "$(variable1) $(variable2) endOfEcho"
value1 true endOfEcho
@echo $(variable1) $(variable2) endOfEcho
value1 true endOfEcho
这篇关于如何在Makefile中注释一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文