title: Adding custom commands to existing targets in qmake
body: <p>Is there a way to specify, in a <em>.pro</em> file, extra commands to be added to  a standard target in the <em>Makefile</em> that <code>qmake</code> generates? For example, consider <code>distclean</code>, extra commands might be desired to:</p>
  
  <ul>
  <li>Remove <em>*~</em> files.</li>
  <li>Clean out runtime-generated output files from the source tree.</li>
  <li>Etc.</li>
  </ul>
  
  <p>I want to use the normal target and not a custom target because I want this to be completely transparent in my workflow. That is (again using <code>distclean</code> as an example), I don't want to...</p>
  
  <ul>
  <li>... require knowledge in a multi-project setup that certain <em>Makefiles</em> use a custom rule instead of <code>distclean</code>.</li>
  <li>... document custom rules, even for stand-alone projects, as <code>distclean</code> is already <a href="http://www.gnu.org/software/make/manual/html_node/Standard-Targets.html" rel="noreferrer">well-known</a> and intuitive<sup>†</sup>. </li>
  </ul>
  
  <p>I found <a href="https://stackoverflow.com/questions/3776476">How to add custom targets in a qmake generated Makefile?</a>, but this describes adding custom targets (which is <a href="http://doc.qt.io/qt-5/qmake-advanced-usage.html" rel="noreferrer">already documented</a>, even <a href="http://doc.qt.digia.com/4.6/qmake-environment-reference.html#customizing-makefile-output" rel="noreferrer">back in 4.6</a>) rather than adding rules to existing targets. While it does contain some hints, all of them require adding new custom targets, as specifying the same target more than once in a <em>Makefile</em> replaces (not adds) commands from the previous target.</p>
  
  <p>The only thing I could really think of to try was to add <code>target.commands += new commands</code> to the <em>.pro</em> file as a wild guess (e.g <code>distclean.commands += rm \"*~\"</code>). This has no effect. </p>
  
  <p>How can I transparently add custom commands to existing targets with <code>qmake</code>?</p>
  
  <hr>
  
  <p><sub><sup>†</sup> <em>For the <code>distclean</code> example: While <code>maintainer-clean</code> is also on that "standard target" list, in practice I have found it to be rarely used, and in any case <code>qmake</code> doesn't generate it by default; I consider it to be unsuitable.</em></sub></p>