consolidate buildFlags() at the common level