views:

52

answers:

1

We have a project that used to be an Eclipse-managed CDT project. However, I am trying to change it to a standard makefile project.

One of them has a couple of symbols defined in

Project Properties->C/C++ General->Paths & Symbols->Symbols. 

The makefiles generated by Eclipse used to automatically get the value when it was managed. The symbols need to be sent to the compiler. How do I get the value in my own makefile? Is there a way?

Thanks, and sorry, I know the questions sounds convoluted.

Edit:

By symbols I mean the -D symbols for the compiler. What we have is a COMPILE_FOR_A & COMPILE_FOR_B and the values are either 1 or 0. If COMPILE_FOR_A=1, it will use particular values, and if COMPILE_FOR_B=1 it will use some other values.

+1  A: 

Use environment variables and conditionals to tell your options to make. Something like:

DEFINES = -DFOO

ifeq ($(COMPILE_FOR_A),1)
    DEFINES += -DBAR
else
    DEFINES += -DBAZ
endif

Then invoke make with/without the variable in the environment:

~$ COMPILE_FOR_A=1 make
Nikolai N Fetissov