title: Predefine a macro in kernel module
body: <p>I would like to define a macro for my kernel module by using the <code>-D</code> flag, but I can't figure out how to do it in a custom loadable kernel module. </p>
  
  <p>Just to be clear, to set the macro TEST to 1 I usually do something like: <br>
  <code>cc -D TEST=1 file.c -o file</code> <br></p>
  
  <p>And inside the file.c I have </p>
  
  <pre><code>#if TEST
     //do something
  #endif
  </code></pre>
  
  <p>Now, having the same code in a kernel module, how can I set TEST to 1 without touching the code? </p>
  
  <p>This is my the Makefile:</p>
  
  <pre><code>all:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD)  modules
  </code></pre>
  
  <p>Since the <code>-C</code> flag it's recursively calling multiple makefiles, adding <code>-D TEST=1</code> does not work, I get the following error:
  <code>make: invalid option -- 'D'</code></p>
  
  <p>Anybody knows how to solve this problem? </p>
  
  <p>Thanks in advance.</p>