title: How to write a Makefile rule to remove files (clean) only if the files are present?
body: <p>It looks to me like Makefile rules can be roughly classified into "positive" and "negative" ones: "positive" rules create missing or update outdated files, while "negative" ones remove files.</p>
  
  <p>Writing prerequisites for "positive" rules is quite easy: if the target and the prerequisite are file names, <code>make</code> by default runs the recipe if the target is missing or outdated (a missing file in this context may be viewed as an infinitely old file).</p>
  
  <p>However, consider a "negative" rule, for example for target <code>clean</code>.  A usual way to write it seems to be something like this:</p>
  
  <pre><code>clean:
      rm -f *.log *.synctex.gz *.aux *.out *.toc
  </code></pre>
  
  <p>This is clearly not the best way to do:</p>
  
  <ol>
  <li><p><code>rm</code> is executed even when there is nothing to do,</p></li>
  <li><p>its error messages and exit status need to be suppressed with <code>-f</code> flag, which has other (possibly undesirable) effects, and</p></li>
  <li><p>the fact that there were nothing to do for target <code>clean</code> is not reported to the user, unlike what is normal for "positive" targets.</p></li>
  </ol>
  
  <p>My question is: how to write a Makefile rule that shall be processed by <code>make</code> only if certain files are present?  (Like what would be useful for <code>make clean</code>.)</p>