assignments
- Simple assignment (:=)
变量一旦赋值,就用这个定义替换这个变量出现的所有地方。 - Recursive assignment (=)
变量遇到了才被替换,可以在之后改变它的值。 - Conditional assignment (?=)
只有变量没有值的时候,该赋值才有效。 - Appending (+=)
例如CC = gcc, CC += -w,CC
现在的值为gcc -w
.
patterns and special variables
%
是通配符匹配,例如%.c
一般用于匹配目录中所有的c
文件。
常用:
%.o: %.c
actions
在actions中,可以使用如下变量:
$@
,当前目标的全称$?
,返回比当前目标更新的依赖$*
,returns the text that corresponds to%
in the target$<