title: GNU make: build all sources in a different directory
body: <p>Given:</p>
  
  <pre><code>programs := apps/prog1 apps/prog2        # the actual list is quite long
  sources := src/prog1.cpp src/prog2.cpp   # showing only 2 files
  </code></pre>
  
  <p>Make file has 2 targets <code>release</code> and <code>debug</code>. Each target should build every program in <code>bin/</code> directory and appends target name to the file name.</p>
  
  <p>For example, building <code>release</code> should create <code>bin/prog1_release</code> and <code>bin/prog2_release</code>.</p>
  
  <p>How to write static pattern rule to do it?</p>
  
  <p>Thanks.</p>