在Makefile中,存在系统默认的自动化变量
$^ :表示所有的依赖文件
$@:表示目标文件
$< :代表第一个依赖文件
hello:main.o fun1.o fun2.o
gcc main.o fun1.o fun2.o -o hello
等价于
hello:main.o fun1.o fun2.o
gcc $^ -o $@
$^ :表示所有的依赖文件
$@:表示目标文件
$< :代表第一个依赖文件
hello:main.o fun1.o fun2.o
gcc main.o fun1.o fun2.o -o hello
等价于
hello:main.o fun1.o fun2.o
gcc $^ -o $@