Makefile improvements: rule consolidation, dependency generation

This PR addresses #599 using the `-MMD` option of gcc/clang (and the `-M` option of nvcc) to automatically generate header file dependencies, finally making the build truly incremental.

In addition, some consolidation of build rules is included (more might be possible), and the explicit enumeration of build directories is made a bit more automatic (further improvements in this direction are also possible).

This is pretty fresh so you might want to let it age a couple days in case I messed something up; I'll be working off this branch.
How does `make` know the object files also depend on whichever automatically generated `*.hpp` header dependencies gcc says are needed?