Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 631
jaeyong Avatar asked Oct 01 '13 10:10

jaeyong


People also ask

What are .D files makefile?

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.

What is .D file used for?

The D file extension is used for files that store code written in a special programming language called D. D is similar to the languages C++ and C#, Java and Eiffel. The file itself can be opened by any text editing program since the source code is saved in a plain text format.

What does .D extension mean?

A D file is a source dependency file generated by GCC, a GNU C compiler. It contains dependencies in plain text that describe the files that were used to create compiled objects (. O files) by a C compiler. D files are generated automatically when the -MMD flag is activated when compiling with GCC.

What is .D and .O file?

The ".o" files are likely intermediate files from which the actual executable program should have been created. The ". d" files are likely internal state used by the makefile, only important if you are making changes to the source code and then rebuilding "incrementally".


1 Answers

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.

like image 139
MadScientist Avatar answered Oct 20 '22 03:10

MadScientist