我是靠谱客的博主 活力墨镜,最近开发中收集的这篇文章主要介绍一个完整的Makefile文件举例,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

# 设置 C 语言的编译器                                                                             
CC = gcc                                                                                          
                                                                                                  
# -g 增加调试信息                                                                                 
# -Wall 打开大部分警告信息                                                                        
CFLAGS = -g -Wall                                                                                 
                                                                                                  
# 整理一下 main 依赖哪些目标文件                                                                  
MAINOBJS = main.o array.o 
 
.PHONY: clean                                                                                     
                                                                                                  
main: $(MAINOBJS)                                                                                 
        $(CC) $(CFLAGS) -o main $(MAINOBJS)                                                       
                                                                                                  
array.o: array.c array.h                                                                          
        $(CC) $(CFLAGS) -c -o array.o array.c                                                     
                                                                                                  
main.o: main.c array.h                                                                            
        $(CC) $(CFLAGS) -c -o main.o main.c                                                       
                                                                                                  
clean:                                                                                            
        rm -f $(MAINOBJS) main  

转载于:https://www.cnblogs.com/candyYang/p/10592854.html

最后

以上就是活力墨镜为你收集整理的一个完整的Makefile文件举例的全部内容,希望文章能够帮你解决一个完整的Makefile文件举例所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(45)

评论列表共有 0 条评论

立即
投稿
返回
顶部