add feature flags for the build process, improve automatic rebuild