Linux C语言:Makefile的使用


Makefile可以更高效的编译文件


1. make -v检查是否安装Makefile

若没有,则输入指令 apt-get install make 进行安装

2. vi Makefile创建并编译文件

3. 编译文件书写的一个例子

# this is make file  //注释
hello.out:max.o min.o hello.c					//生成.out文件所需的文件
		gcc max.o min.o hello.c -o hello.out	//具体生成指令
max.o:max.c										//生成所需文件(没有的)
		gcc -c max.c
min.o:min.c
		gcc -c min.c

4. 输入命令make后生成.out 文件

发布了30 篇原创文章 · 获赞 36 · 访问量 693

猜你喜欢

转载自blog.csdn.net/qq_42745340/article/details/103794100