社区
Linux_Kernel 帖子详情 Linux Makefile探讨,产生的.d文件是.c文件的依赖? fanxing2011 2012-02-20 04:22:36 Linux Makefile探讨,make编译过程中产生的.d文件是.c文件的依赖是什么意思?.c依赖的内容指什么,为什么要产生该依赖文件。d?
...全文
1130 7 打赏 收藏 Linux Makefile探讨,产生的.d文件是.c文件的依赖? Linux Makefile探讨,make编译过程中产生的.d文件是.c文件的依赖是什么意思?.c依赖的内容指什么,为什么要产生该依赖文件。d? 复制链接
扫一扫 分享 转发到动态 举报 AI 作业
写回复 配置赞助广告取 消
确 定
用AI写文章 7 条回复 切换为时间正序 请发表友善的回复… 发表回复 打赏红包 需支付: 0.00 元 取 消 确 定 fanxing2011 2012-02-27 打赏举报 回复 还有一个问题,是否所有的c文件都有对应的d文件,如果不是,什么情况下才有。d文件?(是不是该c文件包含有h文件就一定有对应的d文件?还是说h文件包含其他h文件才会有d文件?) fanxing2011 2012-02-27 打赏举报 回复 gcc -c -MMD hello.c就会产生hello.d
是什么意思?是说如果头文件中包含头文件才会产生。d文件,还是所有用-o选项的就产生。d文件?
楼上说,是生成对应的c文件所依赖的头文件等信息,可否理解为:.d文件是该c文件所有包含的头文件的存放的路径信息??(我打开一个。d文件查看了就是些头文件的所在的路径信息) dedlous 2012-02-21 打赏举报 回复 以前还真没注意过 mymtom 2012-02-21 打赏举报 回复 .d dependencies
依赖文件。
是给Makefile用的。内容和Makefile的target相似:
假设hello.c里有
#include "hello.h"
hello.h里有
#include "foo.h"
#include "bar.h"
gcc -c -MMD hello.c就会产生hello.d
hello.o: hello.c hello.h foo.h bar.h
在Makefile里用-include 进来后
即使hello.c没有修改,即使hello.c没有直接include foo.h bar.h 只要hello.h foo.h bar.h中的任意一个修改都会重新编译hello.c
Arnold9009 2012-02-21 打赏举报 回复 打开任意一个。d文件看看就清楚了,就是生成对应的c文件所依赖的头文件等信息,一般没什么用
偶尔遇到头文件包含相关的问题(如文件包含错了、文件包含冲突等),可以分析这个文件来查找原因 ww2000e 2012-02-20 打赏举报 回复 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
The driver determines file based on whether an -o option is given.
If it is, the driver uses its argument but with a suffix of .d,
otherwise it takes the name of the input file, removes any
directory components and suffix, and applies a .d suffix.
If -MD is used in conjunction with -E, any -o switch is understood
to specify the dependency output file, but if used without -E, each
-o is understood to specify a target object file.
Since -E is not implied, -MD can be used to generate a dependency
output file as a side-effect of the compilation process.
好像是这个,没看懂 空的 2012-02-20 打赏举报 回复 在编译c时我好想还没产生过.d文件。。。坐等楼下解释 linux makefile 工程目录下,所有c文件 linux 工程编译 makefile 工程目录下所有的C文件,工程目录下可以有子目录 Linux_Makefile实验.pdf Linux_Makefile实验.pdf Linux GNU Makefile中文版手册 .rar Linux GNU Makefile中文版手册 Linux内核Makefile文件.doc Linux内核Makefile文件.doc linux的Makefile语法规则借鉴.pdf linux的Makefile语法规则借鉴.pdf
Linux_Kernel
4,465
社区成员
17,462
社区内容
发帖 与我相关 我的任务 Linux_Kernel Linux/Unix社区 内核源代码研究区 复制链接
扫一扫 分享 确定 社区描述 Linux/Unix社区 内核源代码研究区 社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告 试试用AI创作助手写篇文章吧
+ 用AI写文章