模式替换
Another type of substitution reference lets you use the full power of the patsubst function. It has the same form ‘$(var:a=b)’ described above, except that now a must contain a single ‘%’ character. This case is equivalent to ‘$(patsubst a,b,$(var))’. See Functions for String Substitution and Analysis, for a description of the patsubst function. For example: foo := a.o b.o c.o bar := $(foo:%.o=%.c) sets ‘bar’ to ‘a.c b.c c.c’.
关于特殊符号变量
$<表示所有的依赖文件(:右侧的文件)
$@表示所有的目标文件(:左侧的文件)
下面是一个例子
Here is an example, which compiles each of foo.o and bar.o from the corresponding .c file: objects = foo.o bar.o all: $(objects) $(objects): %.o: %.c $(CC) -c $(CFLAGS) $< -o $@