若想生成目标,检查规则中的依赖条件是否存在,如不存在,则去寻找是否有规则去生成依赖文件。如:
makefile
hello:hello.o
gcc hello.o -o hello
hello.o:hello.c
gcc -c hello.c -o hello.o
编译
$ make
gcc -c hello.c -o hello.o
gcc hello.o -o hello
命名: makefile Makefile
目标:依赖条件
[tab]命令
e.g
$ tree
.
├── hello.c
└── makefile
编辑makefile:
hello:hello.c
gcc hello.c -o hello
使用make编译
$ make
gcc hello.c -o hello
$ ls
hello hello.c makefile
原文:https://www.cnblogs.com/zhuxiang1633/p/12287602.html