Can anybody give a clear explanation of how variable assignment really works in Makefiles.
What is the difference between :
VARIABLE = value VARIABLE ?= value VARIABLE := value VARIABLE += value
I have read the section in GNU Make’s manual, but it still doesn’t make sense to me.
Lazy Set
Normal setting of a variable, but any other variables mentioned with the
valuefield are recursively expanded with their value at the point at which the variable is used, not the one it had when it was declaredImmediate Set
Setting of a variable with simple expansion of the values inside – values within it are expanded at declaration time.
Lazy Set If Absent
Setting of a variable only if it doesn’t have a value.
valueis always evaluated whenVARIABLEis accessed. It is equivalent toSee the documentation for more details.
Append
Appending the supplied value to the existing value (or setting to that value if the variable didn’t exist)