Massive rework/rewrite of the build system.