Build system cleanup

Spruce up and extend the build system to facilitate improved distribution packaging.