开发者

How to check value of defined symbols (Eclipse->Paths & Symbols) in a makefile?

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 sym开发者_StackOverflow社区bols 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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜