2.2.2. Externally Managed Build

Build systems not managed by Eclipse.

  • Recommended (needed) for existing projects.
  • Any build system that supports command line build can be covered using this mechanism. (e.g. Using MSVC)

It involves these steps:

  1. Add the source within Eclipse
  2. Tell Eclipse how to build it.
  3. (Optionally) Fix Indexing

Since we are covering Zlib source in this book, let’s have a walk through how that code is imported / built into Eclipse.

Tip

For our example, Zlib is present in C:\sw\src\zlib\1.2.3\zlib-1.2.3

And the build commands is

make -f win32/Makefile.gcc LOC="-DDEBUG -g" all

Follow the steps as shown below to import any Makefile based project into Eclipse.

The parameters in steps marked [X] might have to be adapted other projects.

  1. Create a new C Project. File → New →Project, C Project (Select C++ Project if your project is based on C++`)

  2. [X] Set project name as Zlib-1.2.3

  3. Unset Use default location

  4. [X] Set Location as C:\sw\src\zlib\1.2.3\zlib-1.2.3

  5. Set Project Type as Makefile project → Empty Project

  6. Set Toolchain as MinGW GCC (On Linux, select Linux GCC)

    ../../../_images/c-wiz-new-emptry-makefile-prj.png
  7. Click Next button

  8. Click Advanced Settings

    ../../../_images/c-btn-advanced-settings.png
  9. Select the option, C/C++ Build

    ../../../_images/c-sel-c-cpp-build.png
  10. Change the build command to

    make -f win32/Makefile.gcc LOC="-DDEBUG -g"

    ../../../_images/c-change-build-command.png
  11. The Console view should show the build output.

    ../../../_images/c-scn-console-building.png
  12. The Project Explorer view should show the generated binaries.

    ../../../_images/c-zlib-prj-explr-gen-binaries.png

2.2.2.1. Settings for Externally managed build

The feature to Change the Make Utility is already described.