title: Generating list of generated sources (a la foreach) in automake
body: <p>I am currently working on a project using templates quite extensively, and running into memory constraints during instantiation. I have split up the instantiation into a number of very simple files, which are all three-liners consisting of includes only.</p>
  
  <p>I let these be generated by a rule in Makefile.am. Now I have a quite long list of files that should be generated in my Makefile, and would like to refactor this list with a foreach-like expression. In more specific terms: I have a line like</p>
  
  <pre><code>libfoo_la_SOURCES = a_0.cpp a_1.cpp ... b_0.cpp b_1.cpp ... c_0.cpp c_1.cpp ...
  </code></pre>
  
  <p>which could be more concisely expressed as</p>
  
  <pre><code>libfoo_la_SOURCES = $(foreach i,a b ...,$(foreach j,0 1 ...,$i_$j.cpp))
  </code></pre>
  
  <p>However, the second construct is not only warned against by automake, but also does not work: The files given in this manner are neither compiled nor cleaned.</p>
  
  <p>My current workaround is generating this file list by a shell script.</p>
  
  <p>Any ideas how to implement this iteration?</p>