// Strip the build settings name from the build arguments to generate a list of modes.
f_string_statics_t modes_custom = f_string_statics_t_initialize;
- modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0;
- modes_custom.size = 0;
+
+ if (build_arguments) {
+ if (build_arguments->used > 1) {
+ modes_custom.used = build_arguments->used - 1;
+ }
+ else if (setting->modes.used) {
+ modes_custom.used = setting->modes.used;
+ }
+ }
f_string_static_t modes_custom_array[modes_custom.used];
modes_custom.array = modes_custom_array;
- for (f_array_length_t i = 0; i < modes_custom.used; ++i) {
- modes_custom.array[i] = build_arguments->array[i + 1];
- } // for
+ if (build_arguments) {
+ f_array_length_t i = 0;
+
+ if (build_arguments->used > 1) {
+ for (; i < modes_custom.used; ++i) {
+ modes_custom.array[i] = build_arguments->array[i + 1];
+ } // for
+ }
+ else if (setting->modes.used) {
+ for (; i < setting->modes.used; ++i) {
+ modes_custom.array[i] = setting->modes.array[i];
+ } // for
+ }
+ }
f_string_static_t path_file = f_string_static_t_initialize;
if (F_status_is_fine(status)) {
if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) {
- flockfile(data->main->output.to.stream);
-
- fl_print_format("%r%[Building%] ", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important);
- fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, data_build.setting.build_name, data->main->context.set.notable);
- fl_print_format("%[ using '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important);
- fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, build_arguments && build_arguments->used ? build_arguments->array[0] : data->settings, data->main->context.set.notable);
-
- fl_print_format("%[' with modes '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important);
-
f_string_statics_t modes_custom = f_string_statics_t_initialize;
- modes_custom.used = build_arguments && build_arguments->used > 1 ? build_arguments->used - 1 : 0;
- modes_custom.size = 0;
+
+ if (build_arguments) {
+ if (build_arguments->used > 1) {
+ modes_custom.used = build_arguments->used - 1;
+ }
+ else if (data_build.setting.modes.used) {
+ modes_custom.used = data_build.setting.modes.used;
+ }
+ }
f_string_static_t modes_custom_array[modes_custom.used];
modes_custom.array = modes_custom_array;
- for (f_array_length_t i = 0; i < modes_custom.used; ++i) {
- modes_custom.array[i] = build_arguments->array[i + 1];
- } // for
+ if (build_arguments) {
+ f_array_length_t i = 0;
- // Custom modes are always used if provided, otherwise if any mode is specified, the entire defaults is replaced.
+ if (build_arguments->used > 1) {
+ for (; i < modes_custom.used; ++i) {
+ modes_custom.array[i] = build_arguments->array[i + 1];
+ } // for
+ }
+ else if (data_build.setting.modes.used) {
+ for (; i < data_build.setting.modes.used; ++i) {
+ modes_custom.array[i] = data_build.setting.modes.array[i];
+ } // for
+ }
+ }
+
+ // Custom modes are always used if provided, otherwise fallback to the passed modes or the default modes.
const f_string_statics_t * const modes = modes_custom.used
? &modes_custom
: data->mode.used
? &data->mode
: &data_build.setting.modes_default;
+ flockfile(data->main->output.to.stream);
+
+ fl_print_format("%r%[Building%] ", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important);
+ fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, data_build.setting.build_name, data->main->context.set.notable);
+ fl_print_format("%[ using '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important);
+ fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, build_arguments && build_arguments->used ? build_arguments->array[0] : data->settings, data->main->context.set.notable);
+
+ fl_print_format("%[' with modes '%]", data->main->output.to.stream, data->main->context.set.important, data->main->context.set.important);
+
for (f_array_length_t i = 0; i < modes->used; ) {
fl_print_format("%[%Q%]", data->main->output.to.stream, data->main->context.set.notable, modes->array[i], data->main->context.set.notable);