question on conditional compilation

Hey, can I #define something outside the source file ?

I have a C program which uses #ifdef..

#ifdef ABC
 ... do this..
#else
 ... that ...
#endif

The usual way that I know of defining ABC is in the source/header file

#define ABC

But is there any other way to do that ? Maybe as an option to pass to the compiler ?

The reason is, I just want to run one script/makefile which will compile both versions of the progra, with ABC defined and without ABC defined.. without having to make changes in the source code.

Indeed there are more options.

  1. Put the define in a common include file, such as 'config.h'

  2. Put the define in a compiler option, normally it's

$(CC) $(CFLAGS)  -DMYDEFINE[=myvalue] ....
  1. Put the define in a makefile variable
CFLAGS=$(CFLAGS) -DMYDEFINE[=myvalue]

Thanks buddy !!