You can use the gcc compile option -D -U to compile the soure code debug toggle:
such as:
Compile:
gcc enable the macro YesDebug
$ gcc -DYesDebug -o hello hello.c
$./hello
Yes, this is a macro
gcc disable the macro YesDebug
$ gcc -UYesDebug -o hello hello.c
$./hello
No, there is no macro.
If you define in makefile, you write:
....
CFLAGS=-Wall
ifeq ($(MAKECMDGOALS), YesDebug)
CFLAGS+= -DYesDebug -g -Wall
else
CFLAGS+= -2O -Wall
endif
.....
Different in Debug version and release version.
Some gcc simple compile option:
-D: define a macro
-I : The include directory
-g: add the debug message
-O : the Optimization option
-l: the lib directory