title: How to generate a Makefile with source in sub-directories using just one makefile
body: <p>I have source in a bunch of subdirectories like:</p>
  
  <pre><code>src/widgets/apple.cpp
  src/widgets/knob.cpp
  src/tests/blend.cpp
  src/ui/flash.cpp
  </code></pre>
  
  <p>In the root of the project I want to generate a single Makefile using a rule like:</p>
  
  <pre><code>%.o: %.cpp
     $(CC) -c $&lt;
  
  build/test.exe: build/widgets/apple.o build/widgets/knob.o build/tests/blend.o src/ui/flash.o
     $(LD) build/widgets/apple.o .... build/ui/flash.o -o build/test.exe
  </code></pre>
  
  <p>When I try this it does not find a rule for build/widgets/apple.o. Can I change something so that the %.o: %.cpp is used when it needs to make build/widgets/apple.o ?</p>