您的位置:首页 > 运维架构 > Linux

linux中makefile与gcc编译的比较

2017-08-29 09:28 169 查看
makefile

先查看helloworld.c和Makefile的内容(注意,TAB用在命令前面), 再删掉编译后的文件hello

root@ubuntu:~/lesson/chap1/1-1# more helloworld.c Makefile
::::::::::::::
helloword.c
::::::::::::::
#include<stdio.h>
int main()
{
printf("hello world\n");
return 0;
}
::::::::::::::
Makefile
::::::::::::::
hello:helloworld.c
gcc -o hello helloworld.c
clean:
rm hello
root@ubuntu:~/lesson/chap1/1-1# make
gcc -o hello helloworld.c
root@ubuntu:~/lesson/chap1/1-1# ls
hello  helloworld.c  Makefile
root@ubuntu:~/lesson/chap1/1-1# make clean
rm hello
root@ubuntu:~/lesson/chap1/1-1#


gcc编译

root@ubuntu:~/lesson/chap1/1-1# gcc helloword.c
root@ubuntu:~/lesson/chap1/1-1# ls
a.out  helloword.c  Makefile
root@ubuntu:~/lesson/chap1/1-1#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ubuntu makefile gcc linux