title: Makefile: exit on conditional
body: <p>I want to check that an environment variable is set before executing some code in a Makefile. If it's not set I want to throw an error with a simple error message:</p>
  
  <pre><code>run:
    [ -z "$(MY_APP)" ] &amp;&amp; echo "MY_APP must be set" &amp;&amp; exit 1
    echo "MY_APP is set. Yay!"
    echo "Let's continue on with the command..."
  </code></pre>
  
  <p>When <code>MY_APP</code> is not set I get the following error, which is desired:</p>
  
  <pre><code>[ -z "" ] &amp;&amp; echo "MY_APP must be set" &amp;&amp; exit 1
  MY_APP must be set
  make: *** [run] Error 1
  </code></pre>
  
  <p>However, when <code>MY_APP</code> is set I get the following error:</p>
  
  <pre><code>[ -z "EXAMPLE_NAME" ] &amp;&amp; echo "MY_APP must be set" &amp;&amp; exit 1
  make: *** [run] Error 1
  </code></pre>
  
  <p>Any idea what I'm doing wrong? And is there a better way to do this?</p>