lots of changes to build system

I had a bulleted list typed up but lost it and I'm too lazy to re-type
it...