VARIABLE = value(Lazy Set)
Normal setting of a variable - values within it are recursively expanded when the variable is used, not when it’s declared.
变量的正常设置-在使用变量时,变量中的值将递归展开,而不是在声明变量时展开。
VARIABLE := value (Lazy Set)
Setting of a variable with simple expansion of the values inside - values within it are expanded at declaration time.
用简单的内部值扩展来设置变量-声明时将扩展其中的值。
VARIABLE ?= value(Lazy Set If Absent)
Setting of a variable only if it doesn’t have a value. value is always evaluated when VARIABLE is accessed. It is equivalent to
ifeq ($(origin FOO), undefined)
FOO = bar
endif
仅当变量没有值时才设置该变量。值总是在访问变量时计算的。
VARIABLE += value(Append)
Appending the supplied value to the existing value (or setting to that value if the variable didn’t exist)
将提供的值附加到现有值(如果变量不存在,则将设置附加到该值)。
如果以上两个赋值的不能理解。
举个例子
x = foo
y = $(x) bar
x = xyz
以上y的值将会是 xyz bar。
x := foo
y := $(x) bar
x := xyz
以上y的值将会是 foo bar。