title: How can Makefile use separate directories for source code and binaries?
body: <p>I want to be able to split up my bin and my code files into separate directories as it is becoming hard to manage in it's current state.</p>
  
  <p>I ideally would like to have</p>
  
  <pre><code>project_dir
  |-Makefile
  |-run_tests.sh
  |
  |__source
  |  |-program1.cpp
  |  |-program2.cpp
  |
  |__bin
     |-program1
     |-program2
  </code></pre>
  
  <p>However I am unable to get this to work with my current system without having to manually write out the rules for every program (bear in mind that every program is a separate program, not a series of objects linked together)</p>
  
  <pre><code>#Current make system
  BIN=./bin/
  SOURCE=./source/
  
  LIST=program1 program2...
  
  all: $(LIST)
  
  %:  $(SOURCE)%.cpp
      $(CC) $(INC) $&lt; $(CFLAGS) -o $(BIN)$@ $(LIBS)
  </code></pre>
  
  <p>this works except it I it can't see the target in the current path so it think it always rebuilds the binaries even if the source files haven't changed.</p>
  
  <p>My only thought at the moment is to write a program to make a makefile but I don't want to do that.</p>