Background: I develop in Eclipse, and invoke the makfile from Hudson for nightly builds. I would like different values for some #ifdefs depending on whether the code is built in Eclipse or externally from the makefile.
So, something like #ifdef _Eclipse_ would be nice.
Why would you want to pollute your code like that? (Clarification: I mean write Eclipse- or Hudson-specific code. Just pick a better macro name and define that in Eclipse or Hudson.)
I’d make seperate targets or otherwise change the build file to pass a -DECLIPSE or -DHUDSON to the preprocessor.
Or pass a parameter to make:
Project Properties -> C/C++ Build -> Build command:
make CFLAGS+=-DECLIPSEEdit: I cannot get += to work from the command line. You might want to try, inside the Makefile:
and modify eclipse’s ‘make command’ as such:
make BUILT_BY=eclipse