title: #include dependencies management with autotools
body: <p>I code some C++ software and manage the whole project with the GNU autotools.</p>
  
  <p>I have some part of the C++ code which is really verbose so I have made a script "generator.rb" which generate it automatically in a file "generated.cpp".</p>
  
  <p>I have a build target "generated.cpp" that construct "generated.cpp" from "object_list.txt"</p>
  
  <p>Up to this point everything works correctly.</p>
  
  <p>Now I want to #include this "generated.cpp" file in another one "handwritten.cpp". </p>
  
  <p>Since automake is said to automaticaly compute the dependencies on included files, I expect it to :</p>
  
  <ul>
  <li><p>rebuild "generated.cpp" when building "handwritten.o", if it does not exist or is not up-to-date</p></li>
  <li><p>trigger a new "handwritten.o" build each time object_list.txt has changed</p></li>
  </ul>
  
  <p>So how can I do that ?</p>
  
  <p>Remark : My source tree is like that :</p>
  
  <pre><code>./
  \_src/
  |  \_handwritten.cpp
  |_design/
  |  \_object_list.txt
  \_tools/
     \_generator.rb  
  </code></pre>
  
  <p>Remark : My build tree is like that : </p>
  
  <pre><code>build/
   \_gcc_debug/
      |_src/
      |  \_handwritten.o
      \_design/
         \_generated.cpp
  </code></pre>