title: makefile use variable defined in target
body: <p>How can one use the variable defined inside a make target</p>
  
  <pre><code>.PHONY: foo
  
  VAR_GLOBAL=$(shell cat /tmp/global)
  
  foo:
      echo "local" &gt; /tmp/local
      VAR_LOCAL=$(shell cat /tmp/local)
      echo ${VAR_GLOBAL}
      echo ${VAR_LOCAL}
  </code></pre>
  
  <p>here is the execution output:</p>
  
  <pre><code>$ echo global &gt; /tmp/global
  $ make foo
  echo "local" &gt; /tmp/local
  VAR_LOCAL=local
  echo global
  global
  echo
  </code></pre>