[ACCEPTED]-Using custom Makefile with Eclipse/CDT-eclipse-cdt

Accepted answer
Score: 44

You can create a custom Makefile and make 7 sure it's in your project root. Then you 6 need to disable the auto generated makefiles. You 5 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 4 targets you can open the View called "Make 3 Target":

Window -> Show View -> Make Target

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

Score: 20

There is an option to create a project from 2 existing makefiles: use the "Project Wizard" and 1 select "Makefile project".

Score: 7

You can disable "Generate makefiles automatically" in 2 eclipse project properties -> c/c++ build 1 (builder settings.)

Score: 3

In my latest attempt to compile a Cross 7 ARM compile, I made a painful discovery 6 on how to get this working.

First I created 5 a "Makefile project with existing Code". I 4 selected the Cross ARM tool chain. If I 3 now open a console within Eclipse and make, it 2 works.

Now to build within the GUI, I had 1 to:

  1. Change properties to Internal Builder, with Generate Makefile checked.
  2. The settings option now offers Build Artifact tab. pick executable with ${Project}.
  3. Build. This will result in error in link stage.
  4. Switch the settings to External Builder, uncheck "Automatic Makefile generation"
  5. Clean
  6. Build
Score: 3

All that you have to do is tell gmake to 11 use your makefile. The default command 10 for Code Composer Studio is ${CCS_UTILS_DIR}/bin/gmake. Simply tell 9 gmake to use your own makefile (e.g. sri.mk). We 8 do this with the -f option. So the default 7 command would become ${CCS_UTILS_DIR}/bin/gmake -f ../sri.mk

Note that Code Composer 6 Studio is Eclipse based.

Here are the instructions:

  1. project->properties->C/C++ Build
  2. click on the 'Builder' tab
  3. Un-select 'Use default build command"
  4. Change the command to ${CCS_UTILS_DIR}/bin/gmake -f ../sri.mk

screen capture of gui settings

Note 5 that the build is kicked off from the Debug directory. The 4 Debug directory contains the makefiles that are 3 generated by Eclipse. I put my makefile 2 in the top level directory of the project 1 so that's why I put ../ in -f ../sri.mk.

Score: 1

Also, there might be a line that says "default: esh $(PLUGIN_SO)," or 4 something along those lines depending on 3 your project. I've found that changing the 2 "default" to "all" will enable the project to compile 1 too. This is a handy feature, eclipse :)

More Related questions