Teach the Makefile build system how to handle SOURCES which include
subdirectories. The only thing needed here is to create the appropriate
object file directories and add those as dependencies for the
compilation rules.

As a consequence, factor the non-source-file-specific dependencies for
compilation rules into a helper variable. This fixes an issue where the
project makefile wasn't actually a dependency of a bunch of compilation
make rules for no apparant reason.

This should have no observable effect for current makefile usage, but
will simplify how we build other libraries and is something CMake
already supports.