title: Automake, generated source files and VPATH builds
body: <p>I'm doing VPATH builds with automake. I'm now also using generated source, with SWIG. I've got rules in <code>Makefile.am</code> like:</p>
  
  <pre><code>dist_noinst_DATA = whatever.swig
  
  whatever.cpp: whatever.swig
      swig -c++ -php $^
  </code></pre>
  
  <p>Then the file gets used later:</p>
  
  <pre><code>myprogram_SOURCES = ... whatever.cpp
  </code></pre>
  
  <p>It works fine when <code>$builddir == $srcdir</code>. But when doing VPATH builds (e.g. <code>mkdir build; cd build; ../configure; make</code>), I get error messages about missing <code>whatever.cpp</code>.</p>
  
  <p>Should generated source files go to <code>$builddir</code> or <code>$srcdir</code>? (I reckon probably <code>$builddir</code>.)</p>
  
  <p>How should dependencies and rules be specified to put generated files in the right place?</p>