Make build and smart-build.pl work properly when the cwd is not their location