I'm trying to set up a makefile that compiles multiple segments of a rather lagrge program. In order to do so I want a Makefile to be able to pass MULTIPLE debug flags at once So I can test multiple different sets of functions together.
So in my Makefile :
debug:
gcc -Wall -O -o my_malloc main.c -D experimental leak <-- SECOND FLAG
./my_malloc
And in my C code I want to do :
#ifdef experimental
printf("MALLOC PROGRAM IN DEBUGGING MODE\n");
#endif
//executing both conditionals at once in one line.
#ifdef leak
puts("TESTING LEAK DETECTION");
#endif
The -D
flag syntax is a bit different from what you wrote above. If you want to use more than one definition, use two different flags:
gcc -Wall -Dexperimental -Dleak -O -o my_malloc main.c