Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding the folders and files generated by Eclipse

Tags:

eclipse

Short version of the question: What are objects.mk, sources.mk, makefile, subdir.mk, *.o and *.d files generated by Eclipse?


Long Version of the question:

  1. In my home directory I have the workspace directory. Whenever I create a project and call it ProjectName a new directory (also called ProjectName) is created by Eclipse in the workspace folder.
  2. In my project I create different classes, every class is associated with 2 files (source file ClassName.cpp and header file ClassName.h). These files are put into the workspace/ProjectName/src folder.
  3. Now I Build my project in Eclipse and in the workspace/ProjectName a new folder appears. It is called Debug.
  4. In this folder there is only one file whose functionality I understand: ProjectName. It is the executable. If I type its name in the command line, my program will be executed.
  5. Another 3 files are unknown to me: objects.mk, sources.mk, makefile.
  6. Moreover, in Debug folder there is src directory. It contains subdir.mk file whose meaning is unknown to me as well as ClassName.o and ClassName.d files (if I have N classes there will be N pairs of the *.o and *.d files.)

Can anybody, please, explain the meaning and purpose of these files?

like image 335
Roman Avatar asked Jan 17 '13 10:01

Roman


1 Answers

objects.mk, sources.mk, makefile and subdir.mk are makefiles generated by Eclipse according to your project type (executable, library, shared library). For their contents and how these work refer to the make command documenation of your toolchain. In short these are responsible to call the compiler and linker.

ClassName.o is the object file generated by the compiler, all of them will be linked together to an executable or stored in a library (depending on project type).

ClassName.d is a so called dependency reference file that is generated by the compiler (on demand) and included into the makefiles, that it's possible to track changes in header files, and recompile the concerned source files if neccessary.

like image 143
πάντα ῥεῖ Avatar answered Sep 28 '22 08:09

πάντα ῥεῖ