Fixes for various issues in the build system
More makefile fixes.