Create build directory only when needed.