title: Define make variable from $(shell) as a string in C
body: <p>I am compiling code using a makefile for an embedded application on the STM32f4 family of chips.</p>
  
  <p>When I do:</p>
  
  <p>Makefile:</p>
  
  <pre><code>DEFINES += -DGIT_HASH="test hash"
  </code></pre>
  
  <p>In my <code>main.c</code>:</p>
  
  <pre><code>const char * git_hash = GIT_HASH;
  </code></pre>
  
  <p>When I print out <code>git_hash</code>, I get <code>test hash</code>.</p>
  
  <p>What I would like to do is:</p>
  
  <p>Makefile:</p>
  
  <pre><code>COMMIT_HASH = $(shell git rev-parse HEAD)
  DEFINES += -DGIT_HASH=$(COMMIT_HASH)
  </code></pre>
  
  <p>In my <code>main.c</code>:</p>
  
  <pre><code>const char * git_hash = GIT_HASH;
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>&lt;command-line&gt;:0:10: error: 'c1920a032c487a55b1b109d8774faf05e2ba42d0' undeclared here (not in a function)
  src/run/main.c:173:25: note: in expansion of macro 'GIT_HASH'
   const char * git_hash = GIT_HASH;
  </code></pre>
  
  <p>I am wondering why the <code>COMMIT_HASH</code> is not treated the same way as a string. Any insight would be appreciated.</p>