makefile 里面 := 和 = 的区别

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

原文地址:https://www.cnblogs.com/eustoma/p/4538294.html