title: compile all cpp files in directory with makefile
body: <p>I am doing a project which is growing pretty fast and manually compiles the project is getting to much work. Therefore i want a makefile to automize this process. I makefile should only compile all the files from the src directory (and all those files in subfolders). </p>
  
  <p>Project directory is as follows:</p>
  
  <pre><code>-src
  --files.cpp
  --files.h
  --|-dirA
  ---|-aa.cpp
  ---|-aa.h
  ---|-ab.cpp
  ---|-ab.h
  --|-dirB
  ---|-ba.cpp
  ---|-ba.h
  ---|-bb.cpp
  ---|-bb.h
  </code></pre>
  
  <p>and a main.cpp in the root directory</p>
  
  <p>So far my makefile gets all the cpp files from the src folder:</p>
  
  <pre><code>
  SRC_DIR ?= ./src
  OBJ_DIR := ./obj
  SRC_FILES := $(shell find $(SRC_DIRS) -name '*.cpp')
  
  </code></pre>
  
  <p>I'm not sure how to continue from this.</p>