1. 赋值运算符的辨析:
= 基本的赋值
:= 覆盖之前的值
?= 如果没有被赋值过,就赋予等号后面的值
+= 添加等号后面的值
注意:
make会将整个 makefile 展开后,再决定变量的值,例如:
x = foo y = $(x) bar x = xyz
这个例子中,y的值将会是 xyz bar ,而不是 foo bar 。
如果不想上述效果,则需要使用 := 赋值符号,例如:
x := foo y := $(x) bar x := xyz
这个例子中,y的值将会是 foo bar ,而不是 xyz bar 。