Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using custom Makefile with Eclipse/CDT [duplicate]

I have a project of multiple .c and .h files and I write my own makefile.

How can I configure Eclipse to use my makefile and my source files from their original locations?

like image 243
Stoiko Avatar asked Dec 08 '09 16:12

Stoiko


People also ask

What is the benefit of using Makefiles?

Advantages: It makes codes more concise and clear to read and debug. No need to compile entire program every time whenever you make a change to a functionality or a class. Makefile will automatically compile only those files where change has occurred.

Are Makefiles necessary?

A makefile is useful because (if properly defined) allows recompiling only what is needed when you make a change. In a large project rebuilding the program can take some serious time because there will be many files to be compiled and linked and there will be documentation, tests, examples etc.

Where is the makefile located in eclipse?

By default you should have [workspace]/[project folder]/Debug/makefile.


1 Answers

You can create a custom Makefile and make sure it's in your project root. Then you need to disable the auto generated makefiles. You can do that by going here:

Project Properties (right click on project and select properties) -> C/C++ Build -> in that window uncheck "Generate Makefiles Automatically."

To use your own targets you can open the View called "Make Target":

Window -> Show View -> Make Target

In that view you can create a new target that will use the corresponding target in your custom Makefile.

like image 125
nates Avatar answered Sep 21 '22 22:09

nates