您的位置:首页 > 其它

makefile 里面 := 和 = 的区别

2015-05-29 13:32 246 查看
Makefile 文件里面

用 :=,表示变量赋值的时候立刻展开。

用 =,表示变量被用的时候才展开。

下面是例子:

animal=frog
var="$(animal) dog cat"
animal=hello
test:
  @echo $(var)

#输出结果是:
#hello dog cat

animal=frog
var:="$(animal) dog cat"
animal=hello
test:
  @echo $(var)

#输出结果是:
#frog dog cat
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: