Move build-time variables from version.h to Makefile, reorganize Makefile