title: Conditional compilation in C not working as expected
body: <p>Here is my main program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
      #ifdef MONO
      printf("MONO is defined\n");
  
      #elif DEBUG
      printf("DEBUG is defined\n");
  
      #else
      printf("Nothing is defined\n");
      #endif
  
      return 0;
  }
  </code></pre>
  
  <p>and my makefile:</p>
  
  <pre><code># Makefile Variables
  CC = gcc
  EXEC     =
  CFLAGS = -Wall -g -ansi -pedantic -Werror
  OBJ      = test.o
  
  # Add MONO to the CFLAGS and recompile the program
  ifdef
  CFLAGS += -D MONO
  FANCY : clean $(EXEC)
  endif
  
  # Add DEBUG to the CFLAGS and recompile the program
  ifdef
  CFLAGS += -D DEBUG
  DEBUG : clean $(EXEC)
  endif
  
  $(EXEC) : $(OBJ)
          $(CC) $(OBJ) -o $(EXEC)
  
  test.o : test.c
          $(CC) $(CFLAGS) test.c -c
  
  clean:
          rm -f $(EXEC) $(OBJ)
  </code></pre>
  
  <p>Basically, I'm trying to use DEBUG and MONO for conditional compilation. The problem is that when both are undefined in my Makefile, as you can see above, it still prints "Testing... MONO is defined". I compile by typing "make" which gives me "gcc -Wall -g -ansi -pedantic -Werror test.c -c" and run by ./test</p>