http://stackoverflow.com/questions/448910/makefile-variable-assignment

更加全面的介绍 http://blog.csdn.net/ruglcc/article/details/7814546/

这个是原作者http://blog.csdn.net/haoel/article/details/2896

Lazy Set

VARIABLE = value

Normal setting of a variable - values within it are recursively expanded when the variable is used, not when it's declared

Immediate Set

VARIABLE := value

Setting of a variable with simple expansion of the values inside - values within it are expanded at declaration time.

Set If Absent

VARIABLE ?= value

Setting of a variable only if it doesn't have a value

Append

VARIABLE += value

Appending the supplied value to the existing value (or setting to that value if the variable didn't exist)

还有一个在“嵌套执行”中比较有用的参数,“-w”或是“--print-directory”会在make的过程中输出一些信息,让你看到目前的工作目录。比如,如果我们的下级make目录是“/home/hchen/gnu/make”,如果我们使用“make -w”来执行,那么当进入该目录时,我们会看到:

make: Entering directory `/home/hchen/gnu/make'.

而在完成下层make后离开目录时,我们会看到:

make: Leaving directory `/home/hchen/gnu/make'

当你使用“-C”参数来指定make下层Makefile时,“-w”会被自动打开的。如果参数中有“-s”(“--slient”)或是“--no-print-directory”,那么,“-w”总是失效的。

05-08 15:23