1. make基本语法规则的学习
<target> : <prerequisites>
[tab] <commands>
参考:http://www.ruanyifeng.com/blog/2015/02/make.html
试验:
c代码:test.c
#include <stdio.h>
int main()
{
printf("Hello, I'm from oldmtn...\n");
return 0;
}
Makefile内容
test: test.o
cc -o test test.o
test.o : test.c
cc -c test.c
clean :
rm test.o test
直接makefile就可以生成可执行文件了,哈哈。。
这里的输出为:
huanghao@mountain:~/pj_person/test_linux$ make
cc -c test.c
cc -o test test.o
但是实际我们并不想打印具体的编译代码,所以需要学习回声。
2. 回声
修改Makefile为即可:
test: test.o
@cc -o test test.o
test.o : test.c
@cc -c test.c
clean :
@rm test.o test