Move source files into subdirectories

Which involves lots of reworking of the makefile.