I have a C++ preprocessor written like this:
#ifdef cpp_variable
//x+y;
#endif
Can anyone tell me how to define this in Makefile.
I have a C++ preprocessor written like this:
#ifdef cpp_variable
//x+y;
#endif
Can anyone tell me how to define this in Makefile.
This is compiler specific.
GCC uses
-Dcpp_variable=VALUE
or just-Dcpp_variable
Microsoft's compilers use
/D
Add to Makefile:
Search your compiler documentation to find how to do that.
For example for
g++
the syntax is :Which corresponds to adding
in your makefile.
Take a variable in Makefile and whatever you need to define in it just add -DXXX. Where XXX in you case is cpp_variable.
For example
COMPILE_OPTS = -DXXX
g++ -c $(COMPILE_OPTS) $<
The syntax is compiler specific, for gcc use the
-D
option like so:-Dcpp_variable
.