title: Sources from subdirectories in Makefile
body: <p>I have a C++ library built using a Makefile. Until recently, all the sources were in a single directory, and the Makefile did something like this</p>
  
  <p><code>SOURCES = $(wildcard *.cpp)</code></p>
  
  <p>which worked fine.</p>
  
  <p>Now I've added some sources that are in a subdirectory, say <code>subdir</code>. I know I can do this</p>
  
  <p><code>SOURCES = $(wildcard *.cpp) $(wildcard subdir/*.cpp)</code></p>
  
  <p>but I'm looking for a way to avoid specifying <code>subdir</code> manually, that is, make <code>wildcard</code> look into subdirectories, or generating a list of subdirectories somehow and expanding it with several <code>wildcard</code> functions. At this point, having a non-recursive solution (that is, expanding only the first level) would be fine.</p>
  
  <p>I haven't found anything - my best guess is using <code>find -type d</code> to list the subdirectories, but it feels like a hack. Is there any built-in way to do this?</p>