0
点赞
收藏
分享

微信扫一扫

Makefile多目标


Makefile 规则中目标可以有多个。如需要生成多个可执行文件的做法。使用伪目标的方法,给伪目标指定所依赖的文件:

all:main hello test
.PHONY:all
main:
gcc -o main main.c
hello:
gcc -o hello hello.c
test:
gcc -o test test.c

.PHONY:clean
clean:
rm

生成3个可执行文件,只需要执行一个make all命令。
执行结果 :

~/Desktop/testm$ make
gcc -o main main.c
gcc -o hello hello.c
gcc -o test test.c

谢谢阅读


举报

相关推荐

0 条评论