title: Store the result of a command in Makefile in a variable
body: <p>In a Makefile, how can I store the output of a command as a variable?</p>
  
  <p>I am trying:</p>
  
  <pre><code>vm_instance_name = foo
  registry = us.gcr.io/acmeinc
  image_name = bar
  image_tag = $(docker images ${registry}/${image_name} | awk '{print $2}' | awk 'NR==2')
  
  deploy:
      gcloud beta compute instances update-container $(vm_instance_name) --container-image=$(registry)/$(image_name):$(image_tag)
  </code></pre>
  
  <p>But that's not working. <code>$image_tag</code> is empty.</p>