Linux 使用 make 构建后的 .d 文件是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19114410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what is .d file after building with make
提问by jaeyong
Sometimes, I find .d files for a given source file. For instance, if I compile test.c, I've got
有时,我会为给定的源文件找到 .d 文件。例如,如果我编译 test.c,我有
test.d, test.o
I understand that test.o is the object file but have no idea what is test.d for. Could you give any hints or pointers?
我知道 test.o 是目标文件,但不知道 test.d 是什么。你能给出任何提示或指示吗?
采纳答案by MadScientist
Many build systems add automatically detected make dependencies into the .d
file. In particular, for C/C++ source files they determine what #include
files are required and automatically generate that information into the .d
file.
许多构建系统将自动检测到的 make 依赖项添加到.d
文件中。特别是,对于 C/C++ 源文件,它们确定#include
需要哪些文件并自动将该信息生成到.d
文件中。
The .d
files are then included by the makefile so make is aware of that information. If you look at the contents of those files they'll be make prerequisite statements, like:
.d
然后这些文件包含在 makefile 中,因此 make 知道该信息。如果您查看这些文件的内容,它们将做出先决条件声明,例如:
foo.o : foo.h bar.h biz.h
etc.
等等。