title: Running a program/script from QMake
body: <p>We have a fairly large code-base.  The vast majority of the code is compiled using qmake to produce the makefiles.  However, there are some sub-projects that get produced by running batch files or running other programs.</p>
  
  <p>I'd like to be able to have everything compiled using qmake, but I can't figure out how to get qmake to simply run a script.</p>
  
  <p>One thing that I've tried is using QMAKE_EXTRA_TARGETS in my pro file, like so:</p>
  
  <pre><code>TEMPLATE = lib
  SOURCES = placeholder.cpp
  CONFIG += no_link staticlib
  batch_runner.target   = placeholder.cpp
  batch_runner.commands = my_batch_file.bat
  QMAKE_EXTRA_TARGETS   = batch_runner
  </code></pre>
  
  <p>I then have to have the batch file produce placeholder.cpp like so:</p>
  
  <pre><code># do the real work here
  # ...
  # create placeholder.cpp so qmake and nmake are happy
  echo // dummy &gt;&gt; placeholder.cpp
  </code></pre>
  
  <p>This seems to work fine.  The trouble is that it is somewhat hokey.  If I don't specify batch_runner.target (i.e. I leave it blank) or don't put placeholder.cpp in SOURCES then the batch file never gets run.  This is because qmake isn't making batch_runner.commands the action for any other dependency in the Makefile.</p>
  
  <p>Is there any better way to get QMake to construct a Makefile such that a script is run when the Makefile executes?</p>