此文版权属于作者所有,任何人、媒体或者网站转载、借用都必须征得作者本人同意!
参考:What is the colon equals sign ( := ) in makefiles?
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 |