Makefile之clean
源代码:
#hello.makefile
set tabstop=4
CC =gcc
hello : hello.o
$(CC) -o hello hello.o
hello.o:
$(CC)-c hello.c
.PHONY: clean
clean:
rmhello
rm*.o
运行结果:
本文介绍了一个简单的Makefile示例,重点讲解了如何通过定义clean规则来清理编译产生的文件。该Makefile使用gcc作为编译器,并包含了目标文件的构建及清理过程。
Makefile之clean
源代码:
#hello.makefile
set tabstop=4
CC =gcc
hello : hello.o
$(CC) -o hello hello.o
hello.o:
$(CC)-c hello.c
.PHONY: clean
clean:
rmhello
rm*.o
运行结果:
2800
741

被折叠的 条评论
为什么被折叠?