Fixes to build system.
Dependency checking moved outside of build/clean steps