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#