title: Make: .DELETE_ON_ERROR for directory targets
body: <p>GNU Make includes a special target called <code>.DELETE_ON_ERROR</code>. If this is included in your Makefile, Make will delete any target whose build sequence completes with a non-zero return status. This is helpful so that in subsequent invocations Make does not assume that the target has been properly built.</p>
  
  <p>Here's a dummy example.</p>
  
  <pre><code>.DELETE_ON_ERROR:
  
  out.dat:    in.dat
              touch out.dat
              false
  </code></pre>
  
  <p>Because <code>false</code> gives a non-zero return value, the build is considered failed and Make deletes the <code>out.dat</code> target. This is the advertised and expected behavior. However, this behavior does not seem to be preserved when the target is a directory. Consider another dummy example.</p>
  
  <pre><code>.DELETE_ON_ERROR:
  
  outdir/:    in.dat
              mkdir outdir/
              false
  </code></pre>
  
  <p>In this case, the build fails again but Make does not remove the <code>outdir</code> directory. <strong>Is there any way I can instruct Make to do this?</strong></p>