aargh, make and subdirectories.
There are two ways of dealing with this:
1. Recursive make
In each subdirectory you have a Makefile that compiles the code in that subdirectory to object files.
There is a main Makefile in the root directory that calls these Makefiles and then does a final link
http://www.makelinux.net/make3/make3-CHP-6-SECT-1
2. Have one Makefile in the root using full paths from there for every operation (compilation and linking)
Recursive make is the traditional way but is actually full of holes, see this
http://miller.emu.id.au/pmiller/books/rmch/
With a single Makefile you have to put the paths into the commands, you could use macros or just literals
I started off with recursive make but then abandoned it for one Makefile. The whole thing is handcrafted, when I add
a new class, I have to add new commands to build and link it into my (growing) Makefile
as a treat a small part of my Makefile
# maths object files
math/Vec3.o : math/Vec3.h math/Vec3.cpp
g++ -c -o math/Vec3.o math/Vec3.cpp
math/Vec4.o : math/Vec3.o math/Vec4.h math/Vec4.cpp
g++ -c -o math/Vec4.o math/Vec4.cpp
math/Quat.o : math/Vec4.o math/Quat.h math/Quat.cpp
g++ -c -o math/Quat.o math/Quat.cpp
tedious maybe, if you don't want to do this that's understandable. Using this method the whole dependency tree is defined precisely (including header files). So if I make a change only that part that needs to be recompiled is done so and nothing is missed out.