what is .d file after building with make

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?


Solution 1:

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.