开发者

Define a pre-processor variable for all the files in make

开发者 https://www.devze.com 2023-04-07 07:37 出处:网络
I have a number of .c and .h files with some parts of the code disabled by putting the code block in pre-processor directives e.g.

I have a number of .c and .h files with some parts of the code disabled by putting the code block in pre-processor directives e.g.

#ifdef FOOBAR
// some code that can be compiled if needed by defining FOOBAR in pre-processor.
#endif

No I need to define FOOBAR such that its defined for every file that is compiled by gcc using make.

Is there a way to do this wit开发者_JAVA技巧h some option to make or Makefile ?

Thanks.


Add the compiler option -DFOOBAR to the make variable CFLAGS

0

精彩评论

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