Title: If you have a make recipe which creates the target file, or modifies the timestamp of the existing out-or-date target, and that recipe fails, make will not delete the target. Thus it looks up-to-date, even though the recipe failed.<p>The manual says: <i>&quot;So generally the right thing to do is to delete the target file if the recipe fails after beginning to change the file. make will do this if .DELETE_ON_ERROR appears as a target. This is almost always what you want make to do, but it is not historical practice; so for compatibility, you must explicitly request it.&quot;</i><p>So, hidden in the manual is the recommendation that, it&#x27;s good practice to have<p><pre><code>  .DELETE_ON_ERROR:
</code></pre>
somewhere in every GNU Makefile.<p>An example where this is relevant:<p><pre><code>  foo: bar
      generate bar &gt; foo  # redirection is used
</code></pre>
redirection will create the file or touch the timestamp of the existing one before the <i>generate</i> command is run. What if bar has syntax errors and generate fails?  The foo file was touched and so looks updated. If you run &quot;make foo&quot; again, Make reports that foo is up-to-date.<p>With .DELETE_ON_ERROR, foo will be deleted.<p>If foo exists and its timestamp is not changed, then it&#x27;s left alone.<p>If a recipe creates or touches the target, and fails due to Make being interrupted by a signal, in that case make deletes the target without any option having to be specified.
Upvote: