Coder Perfect

What is a.d file after a make build?


I occasionally come across.d files for a given source file. If I compile test.c, for example, I get

test.d, test.o

I know that test.o is the object file, but I’m not sure what test.d is for. Could you provide any pointers or hints?

Asked by jaeyong

Solution #1

Many build systems populate the.d file with automatically discovered make dependencies. They detect which #include files are required for C/C++ source files and generate that information into the.d file automatically.

The makefile then includes the.d files, making make aware of the information. If you look at the contents of such files, you’ll notice that they contain precondition statements such as:

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


Answered by MadScientist

Post is based on