what is .d file after building with make

LinuxBuildMakefile

Linux Problem Overview


Sometimes, I find .d files for a given source file. For instance, if I compile test.c, I've got

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?

Linux Solutions


Solution 1 - Linux

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.

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:

foo.o : foo.h bar.h biz.h

etc.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjaeyongView Question on Stackoverflow
Solution 1 - LinuxMadScientistView Answer on Stackoverflow