背景
实例代码
C代码
#include <stdio.h>
int main()
{
printf("hello Makefile!\n");
return 0;
}
Makefile文件
hello:hello.o
gcc -o hello hello.o
hello.o:hello.s
gcc -c -o hello.o hello.s
hello.s:hello.i
gcc -S -o hello.s hello.i
hello.i:hello.c
gcc -E -o hello.i hello.c
.PHONY:clean
clean:
rm -f hello.i hello.s hello.o hello
依赖关系
依赖方法
- gcc -option hello.* hello.* ,就是与之对应的依赖关系。
原理
make是如何工作的,在默认的方式下,也就是我们只输入make命令。那么:
项目清理
本文完