How can I parameterize an Eclipse generated make file

eclipse, eclipse-cdt, makefile

Solution

Makefiles generated by CDT include the following lines:

-include ../makefile.init
 ...
-include ../makefile.defs
 ...
-include ../makefile.targets

That is, you can add e.g. `makefile.defs` in the project root to control the build.

JeffV Edit: I added a makefile.init:

 BOOST_HOME = C:\code\boost_1_48_0
 ZMQ_HOME = C:\code\zmq\zeromq-2.1.11

In the project settings "Build Variables" config I also added these entries:

BOOST_HOME = $(BOOST_HOME)
ZMQ_HOME = $(ZMQ_HOME)

Which causes eclipse to replace ${BOOST_HOME} where it is references in my lib and include paths, with the $(BOOST_HOME) variable in the make file.

This allows me to have a platform specific version of the makefile.init on each build platform.

Problem

I have an Eclipse CDT project that is configured to generate make files. I am developing on windows at the moment, and my build server is running Linux. The make files build well on my local machine, but I have two pre-built external dependencies: boost and ZeroMQ. Both of these have an include directory, a lib directory and an associated dll/so. How can I configure the project such that the generated make files can have different BOOST_HOME or ZMQ_HOME variables that are resolved at make time (as opposed to being baked into the make file).

Original source