Updates for improved Windows build support.

Refactored makefiles to improve cross-platform builds. Various fixes for
Windows build failures.