title: Testing if a file exists in makefile target, and quitting if not present
body: <p>Is there a way to exit with an error condition if a file does not exist? I am currently doing something like this:</p>
  <pre class="lang-Makefile prettyprint-override"><code>all: foo
  
  foo:
      test -s /opt/local/bin/gsort || echo &quot;GNU sort does not exist! Exiting...&quot; &amp;&amp; exit
  </code></pre>
  <p>Running <code>make</code> runs the <code>all</code> target, which runs <code>foo</code>.</p>
  <p>The expectation is that if the <code>test -s</code> conditional fails, then the <code>echo/exit</code> statements are executed.</p>
  <p>However, even if <code>/usr/bin/gsort</code> exists, I get the result of the <code>echo</code> statement but the <code>exit</code> command does not run. This is the opposite of what I am hoping to accomplish.</p>
  <p>What is the correct way to do something like the above?</p>