title: In a Makefile, how can I fetch and assign a git commit hash to a variable?
body: <p>A <strong>make all</strong> clones the git repo.  I want to know what the commit hash is and assign the git commit hash to a variable which can be used later in the Makefile</p>
  
  <p>e.g.</p>
  
  <pre><code>all: download
        echo '$(GIT_COMMIT)'
  
  download:
        cd buildarea &amp;&amp; git clone git@github.com:proj/project.git
        $(eval GIT_COMMIT = $(shell cd buildarea/project &amp;&amp; git log -l --pretty=format:"%H"))
        echo '$(GIT_COMMIT)'
  </code></pre>