From: Kevin Day Date: Tue, 2 Jun 2020 04:43:08 +0000 (-0500) Subject: Progress: featureless make X-Git-Tag: 0.5.0~225 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8c7155b0296c75672f83fdded38867a4e7ebc238;p=fll Progress: featureless make Handle the script sources differently than the bash sources. The bash sources, a scrript, is for generated/processed (and the how is yet to be defined). The more general scripts are meant for already prepared scripts not modified by this program (unless modified by some pre-process or post-process script). The more general scripts does not care what the file is, it just gets copied over into the build scripts program path. Add build_script yes/no setting to conditional include the general scripts when building. Slightly rework the logic when processing the build operation functions. Add the planned functions as stubs, to be completed in a future commit. --- diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 25af6c7..97c5080 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -395,6 +395,7 @@ extern "C" { f_macro_string_dynamic_delete_simple(data->path_sources_bash); f_macro_string_dynamic_delete_simple(data->path_sources_c); f_macro_string_dynamic_delete_simple(data->path_sources_cpp); + f_macro_string_dynamic_delete_simple(data->path_sources_script); f_macro_string_dynamic_delete_simple(data->path_work); f_macro_string_dynamic_delete_simple(data->path_work_includes); diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 0d8e88a..15baed6 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -397,6 +397,7 @@ extern "C" { f_string_dynamic path_sources_bash; f_string_dynamic path_sources_c; f_string_dynamic path_sources_cpp; + f_string_dynamic path_sources_script; f_string_dynamic path_work; f_string_dynamic path_work_includes; @@ -467,6 +468,7 @@ extern "C" { f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ fl_color_context_initialize, \ } #endif // _di_fake_data_ diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 04f5da7..d75404d 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -8,8 +8,9 @@ extern "C" { #endif #ifndef _di_fake_build_copy_ - f_return_status fake_build_copy(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string label, const f_string_static source, const f_string_static destination, const f_string_statics files) { - f_status status = F_none; + void fake_build_copy(const fake_data data, const f_mode mode, const f_string label, const f_string_static source, const f_string_static destination, const f_string_statics files, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + f_directory_statuss failures = f_directory_statuss_initialize; f_string_dynamic path_source = f_string_dynamic_initialize; f_string_dynamic destination_file = f_string_dynamic_initialize; @@ -18,12 +19,12 @@ extern "C" { printf("%cCopying %s.%c", f_string_eol[0], label, f_string_eol[0]); } - f_macro_string_dynamic_new(status, path_source, source.used); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_macro_string_dynamic_new", F_true); + f_macro_string_dynamic_new(*status, path_source, source.used); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamic_new", F_true); f_macro_string_dynamic_delete_simple(path_source); - return status; + return; } memcpy(path_source.string, source.string, source.used); @@ -38,59 +39,59 @@ extern "C" { path_source.used = source.used - 1; } - status = fl_string_dynamic_append_nulless(files.array[i], &path_source); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_dynamic_append_nulless(files.array[i], &path_source); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } - status = fl_string_dynamic_terminate(&path_source); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true); + *status = fl_string_dynamic_terminate(&path_source); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate", F_true); break; } - if ((status = f_directory_is(path_source.string)) == F_true) { - status = fl_directory_copy_content(path_source.string, destination.string, path_source.used, destination.used, mode, f_file_default_read_size, F_false, (data.verbosity == fake_verbosity_verbose) ? f_type_output : 0, &failures); + if ((*status = f_directory_is(path_source.string)) == F_true) { + *status = fl_directory_copy_content(path_source.string, destination.string, path_source.used, destination.used, mode, f_file_default_read_size, F_false, (data.verbosity == fake_verbosity_verbose) ? f_type_output : 0, &failures); - if (F_status_is_error(status)) { + if (F_status_is_error(*status)) { if (data.verbosity == fake_verbosity_verbose) { for (f_string_length j = 0; j < failures.used; j++) { - fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); + fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); } // for - if (F_status_set_fine(status) != F_failure) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_directory_copy_content", F_true); + if (F_status_set_fine(*status) != F_failure) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", F_true); } break; } else if (data.verbosity != fake_verbosity_quiet) { - fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); + fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true); } break; } } - else if (status == F_false) { + else if (*status == F_false) { destination_file.used = 0; - status = fl_string_dynamic_append_nulless(destination, &destination_file); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_dynamic_append_nulless(destination, &destination_file); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } - status = f_file_name_base(path_source.string, path_source.used, &destination_file); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_file_name_base", F_true); + *status = f_file_name_base(path_source.string, path_source.used, &destination_file); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_name_base", F_true); break; } - status = f_file_copy(path_source.string, destination_file.string, mode, f_file_default_read_size, F_false); + *status = f_file_copy(path_source.string, destination_file.string, mode, f_file_default_read_size, F_false); - if (F_status_is_error(status)) { - fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); + if (F_status_is_error(*status)) { + fake_print_error_operation(data.context, data.verbosity, F_status_set_fine(*status), "f_file_copy", "copy", "to", path_source.string, destination_file.string, F_true); break; } @@ -98,25 +99,27 @@ extern "C" { printf("Copied file '%s' to '%s'.%c", path_source.string, destination_file.string, f_string_eol[0]); } } - else if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_directory_is", path_source.string, "create", F_false, F_true); + else if (F_status_is_error(*status)) { + fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_is", path_source.string, "create", F_false, F_true); break; } - status = F_none; + *status = F_none; } // for f_macro_directory_statuss_delete_simple(failures); f_macro_string_dynamic_delete_simple(path_source); f_macro_string_dynamic_delete_simple(destination_file); - return F_none; + if (F_status_is_fine(*status)) { + fake_build_touch(data, file_stage, status); + } } #endif // _di_fake_build_copy_ #ifndef _di_fake_build_skeleton_ - f_return_status fake_build_skeleton(const fake_data data, const fake_build_setting setting, const mode_t mode) { - f_status status = F_none; + void fake_build_skeleton(const fake_data data, const fake_build_setting setting, const mode_t mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; const f_string_static *directorys[] = { &data.path_build, @@ -143,13 +146,13 @@ extern "C" { for (uint8_t i = 0; i < 15; i++) { if (directorys[i]->used == 0) continue; - status = f_directory_create(directorys[i]->string, mode); + *status = f_directory_create(directorys[i]->string, mode); - if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_file_found) continue; + if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_file_found) continue; - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), "f_directory_create", directorys[i]->string, "create", F_false, F_true); - return status; + fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), "f_directory_create", directorys[i]->string, "create", F_false, F_true); + return; } if (data.verbosity == fake_verbosity_verbose) { @@ -157,21 +160,21 @@ extern "C" { } } // for - return F_none; + fake_build_touch(data, file_stage, status); } #endif // _di_fake_build_skeleton_ #ifndef _di_fake_build_execute_process_script_ - f_return_status fake_build_execute_process_script(const fake_data data, const fake_build_setting setting, const f_string_static process_script) { - if (process_script.used == 0) return F_none; + void fake_build_execute_process_script(const fake_data data, const fake_build_setting setting, const f_string_static process_script, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + if (process_script.used == 0) return; - f_status status = F_none; f_string_dynamics arguments = f_string_dynamics_initialize; - status = fll_execute_arguments_add(fake_other_operation_build, fake_other_operation_build_length, &arguments); + *status = fll_execute_arguments_add(fake_other_operation_build, fake_other_operation_build_length, &arguments); // ensure console color mode is passed to the scripts so that they can also react to color mode. - if (!F_status_is_error(status) && data.context.mode != f_color_mode_none) { + if (!F_status_is_error(*status) && data.context.mode != f_color_mode_none) { char argument[3] = { f_console_symbol_disable, 0, 0 }; if (data.context.mode == f_color_mode_dark) { @@ -184,11 +187,11 @@ extern "C" { argument[1] = f_console_standard_short_no_color[0]; } - status = fll_execute_arguments_add(argument, 2, &arguments); + *status = fll_execute_arguments_add(argument, 2, &arguments); } // ensure verbosity level is passed to the scripts so that they can also react to requested verbosity. - if (!F_status_is_error(status) && data.verbosity != fake_verbosity_normal) { + if (!F_status_is_error(*status) && data.verbosity != fake_verbosity_normal) { char argument[3] = { f_console_symbol_disable, 0, 0 }; if (data.verbosity == fake_verbosity_quiet) { @@ -201,14 +204,14 @@ extern "C" { argument[1] = f_console_standard_short_debug[0]; } - status = fll_execute_arguments_add(argument, 2, &arguments); + *status = fll_execute_arguments_add(argument, 2, &arguments); } - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fll_execute_arguments_add", F_true); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_delete_simple(arguments); - return status; + return; } { @@ -272,13 +275,13 @@ extern "C" { data.path_work.used, }; - status = fll_execute_arguments_add_parameter_set(parameters_prefix, parameters_prefix_length, parameters_name, parameters_name_length, parameters_value, parameters_value_length, 7, &arguments); + *status = fll_execute_arguments_add_parameter_set(parameters_prefix, parameters_prefix_length, parameters_name, parameters_name_length, parameters_value, parameters_value_length, 7, &arguments); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fll_execute_arguments_add_parameter_set", F_true); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); f_macro_string_dynamics_delete_simple(arguments); - return status; + return; } } @@ -289,24 +292,24 @@ extern "C" { function = "fl_string_dynamic_append_nulless"; if (process_script.string[0] != '/') { - status = fl_string_dynamic_append_nulless(data.path_data_build, &path); + *status = fl_string_dynamic_append_nulless(data.path_data_build, &path); } - if (!F_status_is_error(status)) { - status = fl_string_dynamic_append_nulless(process_script, &path); + if (!F_status_is_error(*status)) { + *status = fl_string_dynamic_append_nulless(process_script, &path); } - if (!F_status_is_error(status)) { + if (!F_status_is_error(*status)) { function = "fl_string_dynamic_terminate"; - status = fl_string_dynamic_terminate(&path); + *status = fl_string_dynamic_terminate(&path); } - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), function, F_true); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), function, F_true); f_macro_string_dynamic_delete_simple(path); f_macro_string_dynamics_delete_simple(arguments); - return status; + return; } } @@ -326,21 +329,21 @@ extern "C" { f_path_present_working_length }; - f_macro_string_dynamics_new(status, names, 2); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true); + f_macro_string_dynamics_new(*status, names, 2); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_new", F_true); f_macro_string_dynamic_delete_simple(path); f_macro_string_dynamics_delete_simple(arguments); f_macro_string_dynamics_delete_simple(names); - return status; + return; } f_string_dynamic part = f_string_dynamic_initialize; for (uint8_t i = 0; i < 2; i++) { - status = fl_string_append(variables_name[i], variables_length[i], &part); - if (F_status_is_error(status)) break; + *status = fl_string_append(variables_name[i], variables_length[i], &part); + if (F_status_is_error(*status)) break; names.array[names.used].string = part.string; names.array[names.used].used = part.used; @@ -350,7 +353,7 @@ extern "C" { f_macro_string_dynamic_clear(part); } // for - if (!F_status_is_error(status)) { + if (!F_status_is_error(*status)) { if (names.used + setting.environment.used > names.size) { if (names.used + setting.environment.used > f_array_length_size) { if (data.verbosity != fake_verbosity_quiet) { @@ -365,23 +368,24 @@ extern "C" { f_macro_string_dynamic_delete_simple(part); f_macro_string_dynamics_delete_simple(arguments); f_macro_string_dynamics_delete_simple(names); - return F_status_set_error(F_buffer_too_large); + *status = F_status_set_error(F_buffer_too_large); + return; } - f_macro_string_dynamics_resize(status, names, names.used + setting.environment.used); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_macro_string_dynamics_resize", F_true); + f_macro_string_dynamics_resize(*status, names, names.used + setting.environment.used); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); f_macro_string_dynamic_delete_simple(part); f_macro_string_dynamics_delete_simple(arguments); f_macro_string_dynamics_delete_simple(names); - return status; + return; } } for (f_string_length i = 0; i < setting.environment.used; i++) { - status = fl_string_dynamic_append_nulless(setting.environment.array[i], &part); - if (F_status_is_error(status)) break; + *status = fl_string_dynamic_append_nulless(setting.environment.array[i], &part); + if (F_status_is_error(*status)) break; names.array[names.used].string = part.string; names.array[names.used].used = part.used; @@ -394,13 +398,13 @@ extern "C" { f_macro_string_dynamic_delete_simple(part); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_append", F_true); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_append", F_true); f_macro_string_dynamic_delete_simple(path); f_macro_string_dynamics_delete_simple(arguments); f_macro_string_dynamics_delete_simple(names); - return status; + return; } } @@ -411,32 +415,30 @@ extern "C" { f_string_dynamic variable_value = f_string_dynamic_initialize; for (f_string_length i = 0; i < names.used; i++) { - status = f_environment_get_dynamic(names.array[i], &variable_value); - if (F_status_is_error(status)) { - status = F_status_set_fine(status); - - if (status == F_memory_reallocation) { + *status = f_environment_get_dynamic(names.array[i], &variable_value); + if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_memory_reallocation) { function = "f_macro_string_dynamics_resize"; break; } } if (environment_names.used + 1 > environment_names.size) { - f_macro_string_dynamics_resize(status, environment_names, environment_names.size + f_memory_default_allocation_step); + f_macro_string_dynamics_resize(*status, environment_names, environment_names.size + f_memory_default_allocation_step); - if (!F_status_is_error(status)) { - f_macro_string_dynamics_resize(status, environment_values, environment_values.size + f_memory_default_allocation_step); + if (!F_status_is_error(*status)) { + f_macro_string_dynamics_resize(*status, environment_values, environment_values.size + f_memory_default_allocation_step); } - if (F_status_is_error(status)) { + if (F_status_is_error(*status)) { function = "f_macro_string_dynamics_resize"; break; } } - status = fl_string_dynamic_append(names.array[i], &variable_name); + *status = fl_string_dynamic_append(names.array[i], &variable_name); - if (F_status_is_error(status)) { + if (F_status_is_error(*status)) { function = "fl_string_append"; break; } @@ -457,8 +459,8 @@ extern "C" { f_macro_string_dynamics_delete_simple(names); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, status, function, F_true); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, *status, function, F_true); f_macro_string_dynamic_delete_simple(variable_name); f_macro_string_dynamic_delete_simple(variable_value); @@ -466,20 +468,20 @@ extern "C" { f_macro_string_dynamics_delete_simple(environment_values); f_macro_string_dynamic_delete_simple(path); f_macro_string_dynamics_delete_simple(arguments); - return status; + return; } int result = 0; - status = fll_execute_path_environment(path.string, arguments, environment_names, environment_values, &result); + *status = fll_execute_path_environment(path.string, arguments, environment_names, environment_values, &result); f_macro_string_dynamics_delete_simple(environment_names); f_macro_string_dynamics_delete_simple(environment_values); f_macro_string_dynamics_delete_simple(arguments); } - if (F_status_is_error(status)) { - if (F_status_set_fine(status) == F_failure) { + if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_failure) { if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data.context.error, data.context.reset, "ERROR: Failed to execute script: "); @@ -488,16 +490,65 @@ extern "C" { } } else { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fll_execute_path_environment", F_true); + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_execute_path_environment", F_true); } } + else { + fake_build_touch(data, file_stage, status); + } f_macro_string_dynamic_delete_simple(path); - - return status; } #endif // _di_fake_build_execute_process_script_ +#ifndef _di_fake_build_libraries_script_ + void fake_build_libraries_script(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // @todo needs to perform some sort of regex replace on the library scripts. + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_libraries_script_ + +#ifndef _di_fake_build_libraries_shared_ + void fake_build_libraries_shared(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // needs to strip the prefix and the filename extension '.c', '.cpp', etc.. to get the name." (call f_file_name_base() and then find last '.'). + + // $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $flags_all $arguments $flags_shared $flags_library + // ln -vsf lib$name.so.$major.$minor.$micro ${path_build}libraries/shared/lib$name.so.$major + // ln -vsf lib$name.so.$major ${path_build}libraries/shared/lib$name.so + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_libraries_shared_ + +#ifndef _di_fake_build_libraries_static_ + void fake_build_libraries_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // needs to strip the prefix and the filename extension '.c', '.cpp', etc.. to get the name." (call f_file_name_base() and then find last '.'). + + // $linker rcs ${path_build}libraries/static/lib$name.a $sources + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_libraries_static_ + +#ifndef _di_fake_build_objects_static_ + void fake_build_objects_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // needs to strip the prefix and the filename extension '.c', '.cpp', etc.. to get the name." (call f_file_name_base() and then find last '.'). + + // $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_library + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_objects_static_ + #ifndef _di_fake_build_operate_ f_return_status fake_build_operate(const fake_data data) { if (data.verbosity != fake_verbosity_quiet) { @@ -513,32 +564,24 @@ extern "C" { f_macro_mode_set_default_umask(mode, data.umask); - status = fake_build_setting_load(data, &setting); - - if (F_status_is_fine(status)) { - status = fake_build_stage_load(data, &stage); - } + fake_build_setting_load(data, &setting, &status); - if (F_status_is_fine(status) && f_file_exists(stage.file_skeleton.string) != F_true) { - status = fake_build_skeleton(data, setting, mode.directory); + fake_build_stage_load(data, &stage, &status); - fake_build_touch(data, stage.file_skeleton, mode, &status); - } + fake_build_skeleton(data, setting, mode.directory, stage.file_skeleton, &status); - if (F_status_is_fine(status) && f_file_exists(stage.file_process_pre.string) != F_true) { - status = fake_build_execute_process_script(data, setting, setting.process_pre); + fake_build_execute_process_script(data, setting, setting.process_pre, stage.file_process_pre, &status); - fake_build_touch(data, stage.file_process_pre, mode, &status); - } + fake_build_copy(data, mode, "setting files", data.path_data_settings, data.path_build_settings, setting.build_sources_setting, stage.file_sources_settings, &status); - if (F_status_is_fine(status) && f_file_exists(stage.file_sources_settings.string) != F_true) { - status = fake_build_copy(data, setting, mode, "setting files", data.path_data_settings, data.path_build_settings, setting.build_sources_setting); + if (setting.build_language == fake_build_language_type_bash) { + fake_build_libraries_script(data, setting, mode, stage.file_libraries_script, &status); - fake_build_touch(data, stage.file_sources_settings, mode, &status); - } + fake_build_programs_script(data, setting, mode, stage.file_programs_script, &status); - if (setting.build_language == fake_build_language_type_bash) { - // @todo + if (setting.build_script) { + fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, setting.build_sources_script, stage.file_sources_script, &status); + } } else { const f_string_dynamic *path_sources = 0; @@ -550,57 +593,28 @@ extern "C" { path_sources = &data.path_sources_cpp; } - if (F_status_is_fine(status) && f_file_exists(stage.file_sources_headers.string) != F_true) { - status = fake_build_copy(data, setting, mode, "header files", *path_sources, data.path_build_includes, setting.build_sources_headers); - - fake_build_touch(data, stage.file_sources_headers, mode, &status); - } + fake_build_copy(data, mode, "header files", *path_sources, data.path_build_includes, setting.build_sources_headers, stage.file_sources_headers, &status); if (setting.build_shared) { - if (F_status_is_fine(status) && f_file_exists(stage.file_libraries_shared.string) != F_true) { - // @todo - //status = fake_build_libraries_shared(); - - fake_build_touch(data, stage.file_libraries_shared, mode, &status); - } - - if (F_status_is_fine(status) && f_file_exists(stage.file_programs_shared.string) != F_true) { - // @todo - //status = fake_build_programs_shared(); + fake_build_libraries_shared(data, setting, mode, stage.file_libraries_shared, &status); - fake_build_touch(data, stage.file_programs_shared, mode, &status); - } + fake_build_programs_shared(data, setting, mode, stage.file_programs_shared, &status); } if (setting.build_static) { - if (F_status_is_fine(status) && f_file_exists(stage.file_objects_static.string) != F_true) { - // @todo - //status = fake_build_objects_static(); - - fake_build_touch(data, stage.file_objects_static, mode, &status); - } + fake_build_objects_static(data, setting, mode, stage.file_objects_static, &status); - if (F_status_is_fine(status) && f_file_exists(stage.file_libraries_static.string) != F_true) { - // @todo - //status = fake_build_libraries_static(); + fake_build_libraries_static(data, setting, mode, stage.file_libraries_static, &status); - fake_build_touch(data, stage.file_libraries_static, mode, &status); - } - - if (F_status_is_fine(status) && f_file_exists(stage.file_programs_static.string) != F_true) { - // @todo - //status = fake_build_programs_static(); + fake_build_programs_static(data, setting, mode, stage.file_programs_static, &status); + } - fake_build_touch(data, stage.file_programs_static, mode, &status); - } + if (setting.build_script) { + fake_build_copy(data, mode, "scripts", data.path_sources_script, data.path_build_programs_script, setting.build_sources_script, stage.file_sources_script, &status); } } - if (F_status_is_fine(status) && f_file_exists(stage.file_process_post.string) != F_true) { - status = fake_build_execute_process_script(data, setting, setting.process_post); - - fake_build_touch(data, stage.file_process_post, mode, &status); - } + fake_build_execute_process_script(data, setting, setting.process_post, stage.file_process_post, &status); fake_macro_build_settings_delete_simple(setting); fake_macro_build_stage_delete_simple(stage); @@ -609,38 +623,75 @@ extern "C" { } #endif // _di_fake_build_operate_ +#ifndef _di_fake_build_programs_script_ + void fake_build_programs_script(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // @todo needs to perform some sort of regex replace on the program scripts. + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_programs_script_ + +#ifndef _di_fake_build_programs_shared_ + void fake_build_programs_shared(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // needs to strip the prefix and the filename extension '.c', '.cpp', etc.. to get the name." (call f_file_name_base() and then find last '.'). + + // $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $flags_all $arguments $flags_shared $flags_program + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_programs_shared_ + +#ifndef _di_fake_build_programs_static_ + void fake_build_programs_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) { + if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return; + + // needs to strip the prefix and the filename extension '.c', '.cpp', etc.. to get the name." (call f_file_name_base() and then find last '.'). + + // $compiler -static -o ${path_build}programs/static/$name $sources $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_program + + fake_build_touch(data, file_stage, status); + } +#endif // _di_fake_build_programs_static_ + #ifndef _di_fake_build_setting_load_ - f_return_status fake_build_setting_load(const fake_data data, fake_build_setting *setting) { - f_status status = F_none; + void fake_build_setting_load(const fake_data data, fake_build_setting *setting, f_status *status) { + if (F_status_is_error(*status)) return; + f_file file = f_file_initialize; f_string_dynamic buffer = f_string_dynamic_initialize; + *status = F_none; + { f_string name_function = f_string_initialize; name_function = "f_file_exists"; - status = f_file_exists(data.file_data_build_settings.string); + *status = f_file_exists(data.file_data_build_settings.string); - if (status == F_true) { + if (*status == F_true) { name_function = "f_file_open"; - status = f_file_open(data.file_data_build_settings.string, 0, &file); + *status = f_file_open(data.file_data_build_settings.string, 0, &file); - if (status == F_none) { + if (*status == F_none) { name_function = "f_file_read"; - status = f_file_read(file, &buffer); + *status = f_file_read(file, &buffer); f_file_close(&file.id); } } - else if (status == F_false) { - status = F_status_set_error(F_file_found_not); + else if (*status == F_false) { + *status = F_status_set_error(F_file_found_not); } - if (F_status_is_error(status)) { - fake_print_error_file(data.context, data.verbosity, F_status_set_fine(status), name_function, data.file_data_build_settings.string, "create", F_true, F_true); + if (F_status_is_error(*status)) { + fake_print_error_file(data.context, data.verbosity, F_status_set_fine(*status), name_function, data.file_data_build_settings.string, "create", F_true, F_true); f_macro_string_dynamic_delete_simple(buffer); - return status; + return; } } @@ -653,14 +704,14 @@ extern "C" { range.start = 0; range.stop = buffer.used - 1; - status = fll_fss_extended_read(&buffer, &range, &objects, &contents); + *status = fll_fss_extended_read(&buffer, &range, &objects, &contents); - if (F_status_is_error(status)) { + if (F_status_is_error(*status)) { f_macro_fss_objects_delete_simple(objects); f_macro_fss_contents_delete_simple(contents); f_macro_string_dynamic_delete_simple(buffer); - if (status == F_status_set_error(F_incomplete_utf_stop)) { + if (*status == F_status_set_error(F_incomplete_utf_stop)) { if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data.context.error, data.context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at "); @@ -670,7 +721,7 @@ extern "C" { fl_color_print_line(f_type_error, data.context.error, data.context.reset, "')."); } } - else if (status == F_status_set_error(F_incomplete_utf_stop)) { + else if (*status == F_status_set_error(F_incomplete_utf_stop)) { if (data.verbosity != fake_verbosity_quiet) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data.context.error, data.context.reset, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at "); @@ -681,14 +732,14 @@ extern "C" { } } else { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fll_fss_extended_read", F_true); + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fll_fss_extended_read", F_true); } f_macro_fss_objects_delete_simple(objects); f_macro_fss_contents_delete_simple(contents); f_macro_string_dynamic_delete_simple(buffer); - return status; + return; } { @@ -697,12 +748,13 @@ extern "C" { fake_build_setting_name_build_language, fake_build_setting_name_build_libraries, fake_build_setting_name_build_linker, + fake_build_setting_name_build_script, fake_build_setting_name_build_shared, fake_build_setting_name_build_sources_headers, fake_build_setting_name_build_sources_library, fake_build_setting_name_build_sources_program, fake_build_setting_name_build_sources_settings, - fake_build_setting_name_build_sources_shell, + fake_build_setting_name_build_sources_script, fake_build_setting_name_build_static, fake_build_setting_name_defines_all, fake_build_setting_name_defines_shared, @@ -717,8 +769,10 @@ extern "C" { fake_build_setting_name_modes_default, fake_build_setting_name_path_headers, fake_build_setting_name_path_language, + fake_build_setting_name_path_library_script, fake_build_setting_name_path_library_shared, fake_build_setting_name_path_library_static, + fake_build_setting_name_path_program_script, fake_build_setting_name_path_program_shared, fake_build_setting_name_path_program_static, fake_build_setting_name_process_post, @@ -735,12 +789,13 @@ extern "C" { fake_build_setting_name_build_language_length, fake_build_setting_name_build_libraries_length, fake_build_setting_name_build_linker_length, + fake_build_setting_name_build_script_length, fake_build_setting_name_build_shared_length, fake_build_setting_name_build_sources_headers_length, fake_build_setting_name_build_sources_library_length, fake_build_setting_name_build_sources_program_length, fake_build_setting_name_build_sources_settings_length, - fake_build_setting_name_build_sources_shell_length, + fake_build_setting_name_build_sources_script_length, fake_build_setting_name_build_static_length, fake_build_setting_name_defines_all_length, fake_build_setting_name_defines_shared_length, @@ -755,8 +810,10 @@ extern "C" { fake_build_setting_name_modes_default_length, fake_build_setting_name_path_headers_length, fake_build_setting_name_path_language_length, + fake_build_setting_name_path_library_script_length, fake_build_setting_name_path_library_shared_length, fake_build_setting_name_path_library_static_length, + fake_build_setting_name_path_program_script_length, fake_build_setting_name_path_program_shared_length, fake_build_setting_name_path_program_static_length, fake_build_setting_name_process_post_length, @@ -769,12 +826,15 @@ extern "C" { }; f_string_dynamics build_language = f_string_dynamics_initialize; + f_string_dynamics build_script = f_string_dynamics_initialize; f_string_dynamics build_shared = f_string_dynamics_initialize; f_string_dynamics build_static = f_string_dynamics_initialize; f_string_dynamics path_headers = f_string_dynamics_initialize; f_string_dynamics path_language = f_string_dynamics_initialize; + f_string_dynamics path_library_script = f_string_dynamics_initialize; f_string_dynamics path_library_shared = f_string_dynamics_initialize; f_string_dynamics path_library_static = f_string_dynamics_initialize; + f_string_dynamics path_program_script = f_string_dynamics_initialize; f_string_dynamics path_program_shared = f_string_dynamics_initialize; f_string_dynamics path_program_static = f_string_dynamics_initialize; f_string_dynamics process_post = f_string_dynamics_initialize; @@ -790,12 +850,13 @@ extern "C" { &build_language, &setting->build_libraries, &setting->build_linker, + &build_script, &build_shared, &setting->build_sources_headers, &setting->build_sources_library, &setting->build_sources_program, &setting->build_sources_setting, - &setting->build_sources_shell, + &setting->build_sources_script, &build_static, &setting->defines_all, &setting->defines_shared, @@ -810,8 +871,10 @@ extern "C" { &setting->modes_default, &path_headers, &path_language, + &path_library_script, &path_library_shared, &path_library_static, + &path_program_script, &path_program_shared, &path_program_static, &process_post, @@ -825,9 +888,9 @@ extern "C" { f_string function = "fll_fss_snatch_apart"; - status = fll_fss_snatch_apart(buffer, objects, contents, settings_name, settings_length, settings_value, fake_build_setting_total); + *status = fll_fss_snatch_apart(buffer, objects, contents, settings_name, settings_length, settings_value, fake_build_setting_total); - if (status == F_none) { + if (*status == F_none) { f_string_dynamic settings_mode_name_dynamic[fake_build_setting_total]; f_string settings_mode_names[fake_build_setting_total]; f_string_length setting_mode_lengths[fake_build_setting_total]; @@ -864,7 +927,7 @@ extern "C" { } error_printed = F_true; - status = F_status_set_error(F_parameter); + *status = F_status_set_error(F_parameter); break; } @@ -875,8 +938,8 @@ extern "C" { for (j = 0; j < fake_build_setting_total; j++) { setting_mode_lengths[j] = settings_length[j] + 1 + modes->array[i].used; - f_macro_string_dynamic_new(status, settings_mode_name_dynamic[j], setting_mode_lengths[j]); - if (F_status_is_error(status)) { + f_macro_string_dynamic_new(*status, settings_mode_name_dynamic[j], setting_mode_lengths[j]); + if (F_status_is_error(*status)) { function = "f_macro_string_dynamic_new"; break; } @@ -888,10 +951,10 @@ extern "C" { settings_mode_names[j] = settings_mode_name_dynamic[j].string; } // for - if (status == F_none) { - status = fll_fss_snatch_apart(buffer, objects, contents, settings_mode_names, setting_mode_lengths, settings_value, fake_build_setting_total); + if (*status == F_none) { + *status = fll_fss_snatch_apart(buffer, objects, contents, settings_mode_names, setting_mode_lengths, settings_value, fake_build_setting_total); - if (F_status_is_error(status)) { + if (F_status_is_error(*status)) { function = "fll_fss_snatch_apart"; } } @@ -900,12 +963,12 @@ extern "C" { f_macro_string_dynamic_delete_simple(settings_mode_name_dynamic[j]); } // for - if (F_status_is_error(status)) break; + if (F_status_is_error(*status)) break; } // for } - if (F_status_is_error(status)) { - if (status == F_status_set_error(F_string_too_large)) { + if (F_status_is_error(*status)) { + if (*status == F_status_set_error(F_string_too_large)) { if (data.verbosity != fake_verbosity_quiet) { // @todo update FSS functions to return which setting index the problem happened on. fprintf(f_type_error, "%c", f_string_eol[0]); @@ -915,18 +978,21 @@ extern "C" { } } else if (!error_printed) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), function, F_true); + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), function, F_true); } } else { const f_string settings_single_name[] = { fake_build_setting_name_build_language, + fake_build_setting_name_build_script, fake_build_setting_name_build_shared, fake_build_setting_name_build_static, fake_build_setting_name_path_headers, fake_build_setting_name_path_language, + fake_build_setting_name_path_library_script, fake_build_setting_name_path_library_shared, fake_build_setting_name_path_library_static, + fake_build_setting_name_path_program_script, fake_build_setting_name_path_program_shared, fake_build_setting_name_path_program_static, fake_build_setting_name_process_post, @@ -940,12 +1006,15 @@ extern "C" { const f_string_statics *settings_single_source[] = { &build_language, + &build_script, &build_shared, &build_static, &path_headers, &path_language, + &path_library_script, &path_library_shared, &path_library_static, + &path_program_script, &path_program_shared, &path_program_static, &process_post, @@ -963,6 +1032,7 @@ extern "C" { bool *settings_single_bool[] = { 0, + &setting->build_script, &setting->build_shared, &setting->build_static, }; @@ -971,10 +1041,13 @@ extern "C" { 0, 0, 0, + 0, &setting->path_headers, &setting->path_language, + &setting->path_library_script, &setting->path_library_shared, &setting->path_library_static, + &setting->path_program_script, &setting->path_program_shared, &setting->path_program_static, &setting->process_post, @@ -990,6 +1063,9 @@ extern "C" { 4, 1, 1, + 1, + 2, + 2, 2, 2, 2, @@ -1005,7 +1081,7 @@ extern "C" { 3, }; - for (f_array_length i = 0; i < 16; i++) { + for (f_array_length i = 0; i < 18; i++) { if (settings_single_source[i]->used == 0) continue; if (settings_single_source[i]->used > 1) { @@ -1079,23 +1155,23 @@ extern "C" { } } else { - status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } if (settings_single_type[i] == 2) { - status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } } - status = fl_string_dynamic_terminate(settings_single_destination[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true); + *status = fl_string_dynamic_terminate(settings_single_destination[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate", F_true); break; } } @@ -1103,12 +1179,15 @@ extern "C" { } f_macro_string_dynamics_delete_simple(build_language); + f_macro_string_dynamics_delete_simple(build_script); f_macro_string_dynamics_delete_simple(build_shared); f_macro_string_dynamics_delete_simple(build_static); f_macro_string_dynamics_delete_simple(path_headers); f_macro_string_dynamics_delete_simple(path_language); + f_macro_string_dynamics_delete_simple(path_library_script); f_macro_string_dynamics_delete_simple(path_library_shared); f_macro_string_dynamics_delete_simple(path_library_static); + f_macro_string_dynamics_delete_simple(path_program_script); f_macro_string_dynamics_delete_simple(path_program_shared); f_macro_string_dynamics_delete_simple(path_program_static); f_macro_string_dynamics_delete_simple(process_post); @@ -1125,86 +1204,97 @@ extern "C" { } f_macro_string_dynamic_delete_simple(buffer); - - return status; } #endif // _di_fake_build_setting_load_ #ifndef _di_fake_build_stage_load_ - f_return_status fake_build_stage_load(const fake_data data, fake_build_stage *stage) { - f_status status = F_none; + void fake_build_stage_load(const fake_data data, fake_build_stage *stage, f_status *status) { + if (F_status_is_error(*status)) return; const f_string names[] = { + fake_build_stage_libraries_script, fake_build_stage_libraries_shared, fake_build_stage_libraries_static, fake_build_stage_objects_static, fake_build_stage_process_post, fake_build_stage_process_pre, + fake_build_stage_programs_script, fake_build_stage_programs_shared, fake_build_stage_programs_static, fake_build_stage_skeleton, fake_build_stage_sources_headers, + fake_build_stage_sources_script, fake_build_stage_sources_settings, }; const f_string_length lengths[] = { + fake_build_stage_libraries_script_length, fake_build_stage_libraries_shared_length, fake_build_stage_libraries_static_length, fake_build_stage_objects_static_length, fake_build_stage_process_post_length, fake_build_stage_process_pre_length, + fake_build_stage_programs_script_length, fake_build_stage_programs_shared_length, fake_build_stage_programs_static_length, fake_build_stage_skeleton_length, fake_build_stage_sources_headers_length, + fake_build_stage_sources_script_length, fake_build_stage_sources_settings_length, }; f_string_dynamic *values[] = { + &stage->file_libraries_script, &stage->file_libraries_shared, &stage->file_libraries_static, &stage->file_objects_static, &stage->file_process_post, &stage->file_process_pre, + &stage->file_programs_script, &stage->file_programs_shared, &stage->file_programs_static, &stage->file_skeleton, &stage->file_sources_headers, + &stage->file_sources_script, &stage->file_sources_settings, }; + *status = F_none; + for (uint8_t i = 0; i < fake_build_stage_total; i++) { - status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } - status = fl_string_append_nulless(names[i], lengths[i], values[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_append_nulless", F_true); + *status = fl_string_append_nulless(names[i], lengths[i], values[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } - status = fl_string_dynamic_terminate(values[i]); - if (F_status_is_error(status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true); + *status = fl_string_dynamic_terminate(values[i]); + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "fl_string_dynamic_terminate", F_true); break; } } // for - - return status; } #endif // _di_fake_build_stage_load_ #ifndef _di_fake_build_touch_ - void fake_build_touch(const fake_data data, const f_string_dynamic file, const f_mode mode, f_status *status) { - if (F_status_is_fine(*status)) { - *status = f_file_touch(file.string, mode.regular, F_false); + void fake_build_touch(const fake_data data, const f_string_dynamic file, f_status *status) { + if (F_status_is_error(*status)) return; - if (F_status_is_error(*status)) { - fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_touch", F_true); - } + f_mode mode = f_mode_initialize; + + f_macro_mode_set_default_umask(mode, data.umask); + + *status = f_file_touch(file.string, mode.regular, F_false); + + if (F_status_is_error(*status)) { + fake_print_error(data.context, data.verbosity, F_status_set_fine(*status), "f_file_touch", F_true); } } #endif // _di_fake_build_touch_ diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index e824855..5a498a4 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -16,13 +16,16 @@ extern "C" { typedef struct { uint8_t build_language; + bool build_script; bool build_shared; bool build_static; f_string_dynamic path_language; f_string_dynamic path_headers; + f_string_dynamic path_library_script; f_string_dynamic path_library_shared; f_string_dynamic path_library_static; + f_string_dynamic path_program_script; f_string_dynamic path_program_shared; f_string_dynamic path_program_static; f_string_dynamic process_post; @@ -40,7 +43,7 @@ extern "C" { f_string_dynamics build_sources_library; f_string_dynamics build_sources_program; f_string_dynamics build_sources_setting; - f_string_dynamics build_sources_shell; + f_string_dynamics build_sources_script; f_string_dynamics defines_all; f_string_dynamics defines_shared; f_string_dynamics defines_static; @@ -58,6 +61,9 @@ extern "C" { 0, \ F_true, \ F_true, \ + F_true, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ @@ -92,50 +98,53 @@ extern "C" { f_string_dynamics_initialize, \ } - #define fake_macro_build_settings_delete_simple(settings) \ - f_macro_string_dynamic_delete_simple(settings.path_headers) \ - f_macro_string_dynamic_delete_simple(settings.path_language) \ - f_macro_string_dynamic_delete_simple(settings.path_library_shared) \ - f_macro_string_dynamic_delete_simple(settings.path_library_static) \ - f_macro_string_dynamic_delete_simple(settings.path_program_shared) \ - f_macro_string_dynamic_delete_simple(settings.path_program_static) \ - f_macro_string_dynamic_delete_simple(settings.process_post) \ - f_macro_string_dynamic_delete_simple(settings.process_pre) \ - f_macro_string_dynamic_delete_simple(settings.project_level) \ - f_macro_string_dynamic_delete_simple(settings.project_name) \ - f_macro_string_dynamic_delete_simple(settings.version_major) \ - f_macro_string_dynamic_delete_simple(settings.version_micro) \ - f_macro_string_dynamic_delete_simple(settings.version_minor) \ - f_macro_string_dynamics_delete_simple(settings.build_compiler) \ - f_macro_string_dynamics_delete_simple(settings.build_libraries) \ - f_macro_string_dynamics_delete_simple(settings.build_linker) \ - f_macro_string_dynamics_delete_simple(settings.build_sources_headers) \ - f_macro_string_dynamics_delete_simple(settings.build_sources_library) \ - f_macro_string_dynamics_delete_simple(settings.build_sources_program) \ - f_macro_string_dynamics_delete_simple(settings.build_sources_setting) \ - f_macro_string_dynamics_delete_simple(settings.build_sources_shell) \ - f_macro_string_dynamics_delete_simple(settings.defines_all) \ - f_macro_string_dynamics_delete_simple(settings.defines_shared) \ - f_macro_string_dynamics_delete_simple(settings.defines_static) \ - f_macro_string_dynamics_delete_simple(settings.environment) \ - f_macro_string_dynamics_delete_simple(settings.flags_all) \ - f_macro_string_dynamics_delete_simple(settings.flags_library) \ - f_macro_string_dynamics_delete_simple(settings.flags_program) \ - f_macro_string_dynamics_delete_simple(settings.flags_shared) \ - f_macro_string_dynamics_delete_simple(settings.flags_static) \ - f_macro_string_dynamics_delete_simple(settings.modes) \ - f_macro_string_dynamics_delete_simple(settings.modes_default) + #define fake_macro_build_settings_delete_simple(setting) \ + f_macro_string_dynamic_delete_simple(setting.path_headers) \ + f_macro_string_dynamic_delete_simple(setting.path_language) \ + f_macro_string_dynamic_delete_simple(setting.path_library_script) \ + f_macro_string_dynamic_delete_simple(setting.path_library_shared) \ + f_macro_string_dynamic_delete_simple(setting.path_library_static) \ + f_macro_string_dynamic_delete_simple(setting.path_program_script) \ + f_macro_string_dynamic_delete_simple(setting.path_program_shared) \ + f_macro_string_dynamic_delete_simple(setting.path_program_static) \ + f_macro_string_dynamic_delete_simple(setting.process_post) \ + f_macro_string_dynamic_delete_simple(setting.process_pre) \ + f_macro_string_dynamic_delete_simple(setting.project_level) \ + f_macro_string_dynamic_delete_simple(setting.project_name) \ + f_macro_string_dynamic_delete_simple(setting.version_major) \ + f_macro_string_dynamic_delete_simple(setting.version_micro) \ + f_macro_string_dynamic_delete_simple(setting.version_minor) \ + f_macro_string_dynamics_delete_simple(setting.build_compiler) \ + f_macro_string_dynamics_delete_simple(setting.build_libraries) \ + f_macro_string_dynamics_delete_simple(setting.build_linker) \ + f_macro_string_dynamics_delete_simple(setting.build_sources_headers) \ + f_macro_string_dynamics_delete_simple(setting.build_sources_library) \ + f_macro_string_dynamics_delete_simple(setting.build_sources_program) \ + f_macro_string_dynamics_delete_simple(setting.build_sources_setting) \ + f_macro_string_dynamics_delete_simple(setting.build_sources_script) \ + f_macro_string_dynamics_delete_simple(setting.defines_all) \ + f_macro_string_dynamics_delete_simple(setting.defines_shared) \ + f_macro_string_dynamics_delete_simple(setting.defines_static) \ + f_macro_string_dynamics_delete_simple(setting.environment) \ + f_macro_string_dynamics_delete_simple(setting.flags_all) \ + f_macro_string_dynamics_delete_simple(setting.flags_library) \ + f_macro_string_dynamics_delete_simple(setting.flags_program) \ + f_macro_string_dynamics_delete_simple(setting.flags_shared) \ + f_macro_string_dynamics_delete_simple(setting.flags_static) \ + f_macro_string_dynamics_delete_simple(setting.modes) \ + f_macro_string_dynamics_delete_simple(setting.modes_default) #define fake_build_setting_name_build_compiler "build_compiler" #define fake_build_setting_name_build_language "build_language" #define fake_build_setting_name_build_libraries "build_libraries" #define fake_build_setting_name_build_linker "build_linker" + #define fake_build_setting_name_build_script "build_script" #define fake_build_setting_name_build_shared "build_shared" #define fake_build_setting_name_build_sources_headers "build_sources_headers" #define fake_build_setting_name_build_sources_library "build_sources_library" #define fake_build_setting_name_build_sources_program "build_sources_program" #define fake_build_setting_name_build_sources_settings "build_sources_setting" - #define fake_build_setting_name_build_sources_shell "build_sources_shell" + #define fake_build_setting_name_build_sources_script "build_sources_script" #define fake_build_setting_name_build_static "build_static" #define fake_build_setting_name_defines_all "defines_all" #define fake_build_setting_name_defines_shared "defines_shared" @@ -150,8 +159,10 @@ extern "C" { #define fake_build_setting_name_modes_default "modes_default" #define fake_build_setting_name_path_language "path_language" #define fake_build_setting_name_path_headers "path_headers" + #define fake_build_setting_name_path_library_script "path_library_script" #define fake_build_setting_name_path_library_shared "path_library_shared" #define fake_build_setting_name_path_library_static "path_library_static" + #define fake_build_setting_name_path_program_script "path_program_script" #define fake_build_setting_name_path_program_shared "path_program_shared" #define fake_build_setting_name_path_program_static "path_program_static" #define fake_build_setting_name_process_post "process_post" @@ -166,12 +177,13 @@ extern "C" { #define fake_build_setting_name_build_language_length 14 #define fake_build_setting_name_build_libraries_length 15 #define fake_build_setting_name_build_linker_length 12 + #define fake_build_setting_name_build_script_length 12 #define fake_build_setting_name_build_shared_length 12 #define fake_build_setting_name_build_sources_headers_length 21 #define fake_build_setting_name_build_sources_library_length 21 #define fake_build_setting_name_build_sources_program_length 21 #define fake_build_setting_name_build_sources_settings_length 22 - #define fake_build_setting_name_build_sources_shell_length 19 + #define fake_build_setting_name_build_sources_script_length 20 #define fake_build_setting_name_build_static_length 12 #define fake_build_setting_name_environment_length 11 #define fake_build_setting_name_defines_all_length 11 @@ -186,8 +198,10 @@ extern "C" { #define fake_build_setting_name_modes_default_length 13 #define fake_build_setting_name_path_language_length 13 #define fake_build_setting_name_path_headers_length 12 + #define fake_build_setting_name_path_library_script_length 19 #define fake_build_setting_name_path_library_shared_length 19 #define fake_build_setting_name_path_library_static_length 19 + #define fake_build_setting_name_path_program_script_length 19 #define fake_build_setting_name_path_program_shared_length 19 #define fake_build_setting_name_path_program_static_length 19 #define fake_build_setting_name_process_post_length 12 @@ -198,7 +212,7 @@ extern "C" { #define fake_build_setting_name_version_micro_length 13 #define fake_build_setting_name_version_minor_length 13 - #define fake_build_setting_total 35 + #define fake_build_setting_total 38 #define fake_build_setting_bool_yes "yes" #define fake_build_setting_bool_no "no" @@ -209,15 +223,18 @@ extern "C" { #ifndef _di_fake_build_stage_ typedef struct { + f_string_dynamic file_libraries_script; f_string_dynamic file_libraries_shared; f_string_dynamic file_libraries_static; f_string_dynamic file_objects_static; f_string_dynamic file_process_post; f_string_dynamic file_process_pre; + f_string_dynamic file_programs_script; f_string_dynamic file_programs_shared; f_string_dynamic file_programs_static; f_string_dynamic file_skeleton; f_string_dynamic file_sources_headers; + f_string_dynamic file_sources_script; f_string_dynamic file_sources_settings; } fake_build_stage; @@ -232,52 +249,62 @@ extern "C" { f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ + f_string_dynamic_initialize, \ } - #define fake_build_stage_total 10 + #define fake_build_stage_total 13 #define fake_macro_build_stage_delete_simple(stage) \ + f_macro_string_dynamic_delete_simple(stage.file_libraries_script) \ f_macro_string_dynamic_delete_simple(stage.file_libraries_shared) \ f_macro_string_dynamic_delete_simple(stage.file_libraries_static) \ f_macro_string_dynamic_delete_simple(stage.file_objects_static) \ f_macro_string_dynamic_delete_simple(stage.file_process_post) \ f_macro_string_dynamic_delete_simple(stage.file_process_pre) \ + f_macro_string_dynamic_delete_simple(stage.file_programs_script) \ f_macro_string_dynamic_delete_simple(stage.file_programs_shared) \ f_macro_string_dynamic_delete_simple(stage.file_programs_static) \ f_macro_string_dynamic_delete_simple(stage.file_skeleton) \ f_macro_string_dynamic_delete_simple(stage.file_sources_headers) \ + f_macro_string_dynamic_delete_simple(stage.file_sources_script) \ f_macro_string_dynamic_delete_simple(stage.file_sources_settings) + #define fake_build_stage_libraries_script "libraries_script.built" #define fake_build_stage_libraries_shared "libraries_shared.built" #define fake_build_stage_libraries_static "libraries_static.built" #define fake_build_stage_objects_static "objects_static.built" #define fake_build_stage_process_post "process_post.built" #define fake_build_stage_process_pre "process_pre.built" + #define fake_build_stage_programs_script "programs_script.built" #define fake_build_stage_programs_shared "programs_shared.built" #define fake_build_stage_programs_static "programs_static.built" #define fake_build_stage_skeleton "skeleton.built" #define fake_build_stage_sources_headers "sources_headers.built" + #define fake_build_stage_sources_script "sources_script.built" #define fake_build_stage_sources_settings "sources_settings.built" + #define fake_build_stage_libraries_script_length 22 #define fake_build_stage_libraries_shared_length 22 #define fake_build_stage_libraries_static_length 22 #define fake_build_stage_objects_static_length 20 #define fake_build_stage_process_post_length 18 #define fake_build_stage_process_pre_length 17 + #define fake_build_stage_programs_script_length 21 #define fake_build_stage_programs_shared_length 21 #define fake_build_stage_programs_static_length 21 #define fake_build_stage_skeleton_length 14 #define fake_build_stage_sources_headers_length 21 + #define fake_build_stage_sources_script_length 20 #define fake_build_stage_sources_settings_length 22 #endif // _di_fake_build_stage_ /** - * Copy over the data settings files. + * Copy over the data setting files. * * @param data * The program data. - * @param settings - * All build related settings data from the build settings file. * @param mode * The modes for each file type. * @param label @@ -288,13 +315,17 @@ extern "C" { * The specific build path to copy to. * @param files * The files to copy from source to destination. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_copy_ - extern f_return_status fake_build_copy(const fake_data data, const fake_build_setting settings, const f_mode mode, const f_string label, const f_string_static source, const f_string_static destination, const f_string_statics files) f_gcc_attribute_visibility_internal; + extern void fake_build_copy(const fake_data data, const f_mode mode, const f_string label, const f_string_static source, const f_string_static destination, const f_string_statics files, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_copy_ /** @@ -302,17 +333,21 @@ extern "C" { * * @param data * The program data. - * @param settings - * All build related settings data from the build settings file. + * @param setting + * All build related setting data from the build setting file. * @param mode * The directory mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_skeleton_ - extern f_return_status fake_build_skeleton(const fake_data data, const fake_build_setting settings, const mode_t mode) f_gcc_attribute_visibility_internal; + extern void fake_build_skeleton(const fake_data data, const fake_build_setting setting, const mode_t mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_skeleton_ /** @@ -320,21 +355,113 @@ extern "C" { * * @param data * The program data. - * @param settings - * All build related settings data from the build settings file. + * @param setting + * All build related setting data from the build setting file. * @param process_script * The setting_data file name fo the appropriate process script. - * This is expected to be either settings.process_pre or settings.process_post. + * This is expected to be either setting.process_pre or setting.process_post. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_execute_process_script_ - extern f_return_status fake_build_execute_process_script(const fake_data data, const fake_build_setting settings, const f_string_static process_script) f_gcc_attribute_visibility_internal; + extern void fake_build_execute_process_script(const fake_data data, const fake_build_setting setting, const f_string_static process_script, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_execute_process_script_ /** + * Build the script libraries. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_libraries_script_ + extern void fake_build_libraries_script(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_libraries_script_ + +/** + * Build the shared libraries. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_libraries_shared_ + extern void fake_build_libraries_shared(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_libraries_shared_ + +/** + * Build the static libraries. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_libraries_static_ + extern void fake_build_libraries_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_libraries_static_ + +/** + * Build the static objects. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_objects_static_ + extern void fake_build_objects_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_objects_static_ + +/** * Execute the build operation. * * @param data @@ -349,20 +476,88 @@ extern "C" { #endif // _di_fake_build_operate_ /** - * Find the build settings file, load it, validate it, and process it. + * Build the script programs. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_programs_script_ + extern void fake_build_programs_script(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_programs_script_ + +/** + * Build the shared programs. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_programs_shared_ + extern void fake_build_programs_shared(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_programs_shared_ + +/** + * Build the static programs. * * @param data * The program data. - * @param settings - * All build related settings data from the build settings file are loaded into this. - * These settings will have any specified mode property applied. + * @param setting + * All build related setting data from the build setting file. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * The return status. + * + * @return + * F_none on success. + * Status codes (with error bit) are returned on any problem. + */ +#ifndef _di_fake_build_programs_static_ + extern void fake_build_programs_static(const fake_data data, const fake_build_setting setting, const f_mode mode, const f_string_static file_stage, f_status *status) f_gcc_attribute_visibility_internal; +#endif // _di_fake_build_programs_static_ + +/** + * Find the build setting file, load it, validate it, and process it. + * + * @param data + * The program data. + * @param setting + * All build related setting data from the build setting file are loaded into this. + * These setting will have any specified mode property applied. + * @param status + * The return status. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_setting_load_ - extern f_return_status fake_build_setting_load(const fake_data data, fake_build_setting *settings) f_gcc_attribute_visibility_internal; + extern void fake_build_setting_load(const fake_data data, fake_build_setting *setting, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_setting_load_ /** @@ -372,13 +567,15 @@ extern "C" { * The program data. * @param stage * All stage file paths. + * @param status + * The return status. * * @return * F_none on success. * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_stage_load_ - extern f_return_status fake_build_stage_load(const fake_data data, fake_build_stage *stage) f_gcc_attribute_visibility_internal; + extern void fake_build_stage_load(const fake_data data, fake_build_stage *stage, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_stage_load_ /** @@ -388,16 +585,13 @@ extern "C" { * The program data. * @param file * The file path to touch. - * @param mode - * The file mode to use. * @param status * The return status. - * This gets updated if f_file_touch() is executed. * * @see f_file_touch() */ #ifndef _di_fake_build_touch_ - extern void fake_build_touch(const fake_data data, const f_string_dynamic file, const f_mode mode, f_status *status) f_gcc_attribute_visibility_internal; + extern void fake_build_touch(const fake_data data, const f_string_dynamic file, f_status *status) f_gcc_attribute_visibility_internal; #endif // _di_fake_build_touch_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 4b3849d..9fbcb6e 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -21,7 +21,7 @@ extern "C" { const uint8_t parameters_length[] = { 8, 2, - 3, + 4, }; f_string_dynamic *parameters_value_0[] = { @@ -44,6 +44,7 @@ extern "C" { &data->path_sources_bash, &data->path_sources_c, &data->path_sources_cpp, + &data->path_sources_script, }; f_string_dynamic **parameters_value[] = { @@ -79,6 +80,7 @@ extern "C" { fake_path_part_bash, fake_path_part_c, fake_path_part_cpp, + fake_path_part_script, }; const f_string_length parameters_length[] = { @@ -97,6 +99,7 @@ extern "C" { fake_path_part_bash_length, fake_path_part_c_length, fake_path_part_cpp_length, + fake_path_part_script_length, }; f_string_dynamic *parameters_value[] = { @@ -115,9 +118,10 @@ extern "C" { &data->path_sources_bash, &data->path_sources_c, &data->path_sources_cpp, + &data->path_sources_script, }; - for (i = 0; i < 15; i++) { + for (i = 0; i < 16; i++) { status = fl_string_append_nulless(parameters_source[i], parameters_length[i], parameters_value[i]); if (F_status_is_error(status)) { @@ -377,6 +381,7 @@ extern "C" { &data->path_sources_bash, &data->path_sources_c, &data->path_sources_cpp, + &data->path_sources_script, &data->path_work_includes, &data->path_work_libraries, &data->path_work_libraries_script, @@ -392,7 +397,7 @@ extern "C" { &data->file_documents_readme, }; - for (i = 0; i < 33; i++) { + for (i = 0; i < 34; i++) { if (parameters_value[i]->used == 0) continue; status = fl_string_dynamic_terminate(parameters_value[i]); diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index b9209ed..8cde44c 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -28,14 +28,17 @@ build_libraries-monolithic -lfll build_sources_library fake.c private-fake.c private-clean.c private-build.c private-make.c private-print.c private-skeleton.c build_sources_program main.c build_sources_headers fake.h +build_sources_script build_sources_setting -build_sources_shell +build_script yes build_shared yes build_static yes path_headers level_3 +path_library_script script path_library_shared shared path_library_static static +path_poogram_script script path_poogram_shared shared path_poogram_static static