title: 'make' equivalent of -D flag as in gcc
body: <p>My C code has various files having statements that I want to execute only if a macro is defined. I have two files each having the following code:</p>
  
  <pre><code>#ifdef SOME_MACRO
  printf("macro defined\n");
  #else
  printf("macro undefined");
  #endif
  </code></pre>
  
  <p>My Makefile contains:    </p>
  
  <pre><code>make -C /lib/modules/$(shell uname -r )/build M=$(PWD) modules $(CFLAGS)
  </code></pre>
  
  <p>and I am calling make as:</p>
  
  <pre><code>make all CFLAGS=SOME_MACRO=10    
  </code></pre>
  
  <p>When I execute the resulting program, I get 'macro undefined' indicating the macro is not being defined.</p>
  
  <p>I have also tried calling it as:  </p>
  
  <pre><code>make all CFLAGS=SOME_MACRO
  </code></pre>
  
  <p>which gives me:</p>
  
  <pre><code>make[1]: *** No rule to make target `SOME_MACRO'.  Stop.
  make[1]: Leaving directory `/X/Y/Z'
  make: *** [default] Error 2
  </code></pre>
  
  <p>And also calling it as:</p>
  
  <pre><code>make all CFLAGS=-DSOME_MACRO=10
  </code></pre>
  
  <p>as given <a href="https://stackoverflow.com/questions/9052792/how-to-pass-macro-definition-from-make-command-line-arguments-d-to-c-source">here</a> and <a href="https://stackoverflow.com/questions/39362327/how-can-a-macro-definition-be-passed-as-an-argument-to-make?noredirect=1&amp;lq=1">here</a> but this is not working either.       </p>
  
  <p>How do I make this work?</p>