Resolve the fixme regarding the path_sources_object and similar.
Consolidate the static source build into functions.
The fake_build_setting_name_preserve_path_headers_s is in the wrong location, resulting in the incorrect loading of build settings data.
Provide default for path_sources.
Make the main->path_sources a prefix path where all sources exist (there will likely need to be a follow up commit to address this in bootstrap.sh).
Get rid of the path_source_* forr bash, c, and other custom paths.
Get rid of the redundant version default assignment in fake_build_load_setting_defaults().
Rename fake_build_load_setting_defaults() to fake_build_load_setting_override().
Update the skeleton generation.
Add "specifications" directory creation.
Add "sources/script" directory creation.
const f_string_static_t fake_path_part_script_s = macro_f_string_static_t_initialize(FAKE_path_part_script_s, 0, FAKE_path_part_script_s_length);
const f_string_static_t fake_path_part_settings_s = macro_f_string_static_t_initialize(FAKE_path_part_settings_s, 0, FAKE_path_part_settings_s_length);
const f_string_static_t fake_path_part_shared_s = macro_f_string_static_t_initialize(FAKE_path_part_shared_s, 0, FAKE_path_part_shared_s_length);
+ const f_string_static_t fake_path_part_specifications_s = macro_f_string_static_t_initialize(FAKE_path_part_specifications_s, 0, FAKE_path_part_specifications_s_length);
const f_string_static_t fake_path_part_stage_s = macro_f_string_static_t_initialize(FAKE_path_part_stage_s, 0, FAKE_path_part_stage_s_length);
const f_string_static_t fake_path_part_static_s = macro_f_string_static_t_initialize(FAKE_path_part_static_s, 0, FAKE_path_part_static_s_length);
#endif // _di_fake_path_
f_string_dynamic_resize(0, &main->path_licenses);
f_string_dynamic_resize(0, &main->path_sources);
- f_string_dynamic_resize(0, &main->path_sources_bash);
- f_string_dynamic_resize(0, &main->path_sources_c);
- f_string_dynamic_resize(0, &main->path_sources_cpp);
- f_string_dynamic_resize(0, &main->path_sources_script);
-
- f_string_dynamic_resize(0, &main->path_sources_object);
- f_string_dynamic_resize(0, &main->path_sources_object_bash);
- f_string_dynamic_resize(0, &main->path_sources_object_c);
- f_string_dynamic_resize(0, &main->path_sources_object_cpp);
- f_string_dynamic_resize(0, &main->path_sources_object_script);
f_string_dynamic_resize(0, &main->path_work);
f_string_dynamic_resize(0, &main->path_work_includes);
* These structures are hard-coded by their individual pieces to be constructed later on.
*/
#ifndef _di_fake_path_
- #define FAKE_path_part_bash_s "bash" F_path_separator_s
- #define FAKE_path_part_build_s "build" F_path_separator_s
- #define FAKE_path_part_c_s "c" F_path_separator_s
- #define FAKE_path_part_cpp_s "c++" F_path_separator_s
- #define FAKE_path_part_data_s "data" F_path_separator_s
- #define FAKE_path_part_documents_s "documents" F_path_separator_s
- #define FAKE_path_part_includes_s "includes" F_path_separator_s
- #define FAKE_path_part_libraries_s "libraries" F_path_separator_s
- #define FAKE_path_part_licenses_s "licenses" F_path_separator_s
- #define FAKE_path_part_objects_s "objects" F_path_separator_s
- #define FAKE_path_part_process_s "process" F_path_separator_s
- #define FAKE_path_part_programs_s "programs" F_path_separator_s
- #define FAKE_path_part_script_s "script" F_path_separator_s
- #define FAKE_path_part_settings_s "settings" F_path_separator_s
- #define FAKE_path_part_shared_s "shared" F_path_separator_s
- #define FAKE_path_part_stage_s "stage" F_path_separator_s
- #define FAKE_path_part_static_s "static" F_path_separator_s
-
- #define FAKE_path_part_bash_s_length 5 + F_path_separator_s_length
- #define FAKE_path_part_build_s_length 6 + F_path_separator_s_length
- #define FAKE_path_part_c_s_length 2 + F_path_separator_s_length
- #define FAKE_path_part_cpp_s_length 4 + F_path_separator_s_length
- #define FAKE_path_part_data_s_length 5 + F_path_separator_s_length
- #define FAKE_path_part_documents_s_length 10 + F_path_separator_s_length
- #define FAKE_path_part_includes_s_length 9 + F_path_separator_s_length
- #define FAKE_path_part_libraries_s_length 10 + F_path_separator_s_length
- #define FAKE_path_part_licenses_s_length 9 + F_path_separator_s_length
- #define FAKE_path_part_objects_s_length 8 + F_path_separator_s_length
- #define FAKE_path_part_process_s_length 8 + F_path_separator_s_length
- #define FAKE_path_part_programs_s_length 9 + F_path_separator_s_length
- #define FAKE_path_part_script_s_length 7 + F_path_separator_s_length
- #define FAKE_path_part_settings_s_length 9 + F_path_separator_s_length
- #define FAKE_path_part_shared_s_length 7 + F_path_separator_s_length
- #define FAKE_path_part_stage_s_length 6 + F_path_separator_s_length
- #define FAKE_path_part_static_s_length 7 + F_path_separator_s_length
+ #define FAKE_path_part_bash_s "bash" F_path_separator_s
+ #define FAKE_path_part_build_s "build" F_path_separator_s
+ #define FAKE_path_part_c_s "c" F_path_separator_s
+ #define FAKE_path_part_cpp_s "c++" F_path_separator_s
+ #define FAKE_path_part_data_s "data" F_path_separator_s
+ #define FAKE_path_part_documents_s "documents" F_path_separator_s
+ #define FAKE_path_part_includes_s "includes" F_path_separator_s
+ #define FAKE_path_part_libraries_s "libraries" F_path_separator_s
+ #define FAKE_path_part_licenses_s "licenses" F_path_separator_s
+ #define FAKE_path_part_objects_s "objects" F_path_separator_s
+ #define FAKE_path_part_process_s "process" F_path_separator_s
+ #define FAKE_path_part_programs_s "programs" F_path_separator_s
+ #define FAKE_path_part_script_s "script" F_path_separator_s
+ #define FAKE_path_part_settings_s "settings" F_path_separator_s
+ #define FAKE_path_part_shared_s "shared" F_path_separator_s
+ #define FAKE_path_part_specifications_s "specifications" F_path_separator_s
+ #define FAKE_path_part_stage_s "stage" F_path_separator_s
+ #define FAKE_path_part_static_s "static" F_path_separator_s
+
+ #define FAKE_path_part_bash_s_length 4 + F_path_separator_s_length
+ #define FAKE_path_part_build_s_length 5 + F_path_separator_s_length
+ #define FAKE_path_part_c_s_length 1 + F_path_separator_s_length
+ #define FAKE_path_part_cpp_s_length 3 + F_path_separator_s_length
+ #define FAKE_path_part_data_s_length 4 + F_path_separator_s_length
+ #define FAKE_path_part_documents_s_length 9 + F_path_separator_s_length
+ #define FAKE_path_part_includes_s_length 8 + F_path_separator_s_length
+ #define FAKE_path_part_libraries_s_length 9 + F_path_separator_s_length
+ #define FAKE_path_part_licenses_s_length 8 + F_path_separator_s_length
+ #define FAKE_path_part_objects_s_length 7 + F_path_separator_s_length
+ #define FAKE_path_part_process_s_length 7 + F_path_separator_s_length
+ #define FAKE_path_part_programs_s_length 8 + F_path_separator_s_length
+ #define FAKE_path_part_script_s_length 6 + F_path_separator_s_length
+ #define FAKE_path_part_settings_s_length 8 + F_path_separator_s_length
+ #define FAKE_path_part_shared_s_length 6 + F_path_separator_s_length
+ #define FAKE_path_part_specifications_s_length 14 + F_path_separator_s_length
+ #define FAKE_path_part_stage_s_length 5 + F_path_separator_s_length
+ #define FAKE_path_part_static_s_length 6 + F_path_separator_s_length
extern const f_string_static_t fake_path_part_bash_s;
extern const f_string_static_t fake_path_part_build_s;
extern const f_string_static_t fake_path_part_script_s;
extern const f_string_static_t fake_path_part_settings_s;
extern const f_string_static_t fake_path_part_shared_s;
+ extern const f_string_static_t fake_path_part_specifications_s;
extern const f_string_static_t fake_path_part_stage_s;
extern const f_string_static_t fake_path_part_static_s;
#endif // _di_fake_path_
f_string_dynamic_t path_licenses;
f_string_dynamic_t path_sources;
- f_string_dynamic_t path_sources_bash;
- f_string_dynamic_t path_sources_c;
- f_string_dynamic_t path_sources_cpp;
- f_string_dynamic_t path_sources_script;
-
- f_string_dynamic_t path_sources_object;
- f_string_dynamic_t path_sources_object_bash;
- f_string_dynamic_t path_sources_object_c;
- f_string_dynamic_t path_sources_object_cpp;
- f_string_dynamic_t path_sources_object_script;
f_string_dynamic_t path_work;
f_string_dynamic_t path_work_includes;
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
- f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_color_context_t_initialize, \
}
if (F_status_is_error_not(status)) {
- status = fake_build_operate(f_string_empty_s, main);
+ status = fake_build_operate(main, f_string_empty_s);
}
}
else if (main->operation == fake_operation_clean_e) {
}
}
- fake_build_load_setting_defaults(main, setting, status);
+ fake_build_load_setting_override(main, setting, status);
}
#endif // _di_fake_build_load_setting_
fake_build_setting_name_modes_s,
fake_build_setting_name_modes_default_s,
fake_build_setting_name_path_headers_s,
- fake_build_setting_name_preserve_path_headers_s,
fake_build_setting_name_path_language_s,
fake_build_setting_name_path_library_script_s,
fake_build_setting_name_path_library_shared_s,
fake_build_setting_name_path_program_static_s,
fake_build_setting_name_path_sources_s,
fake_build_setting_name_path_sources_object_s,
+ fake_build_setting_name_preserve_path_headers_s,
fake_build_setting_name_process_post_s,
fake_build_setting_name_process_pre_s,
fake_build_setting_name_search_exclusive_s,
fake_path_part_script_s, // path_program_script
fake_path_part_shared_s, // path_program_shared
fake_path_part_static_s, // path_program_static
- f_string_empty_s, // path_sources
+ fake_default_path_sources_s, // path_sources
f_string_empty_s, // path_sources_object
f_string_empty_s, // preserve_path_headers
f_string_empty_s, // process_post
}
#endif // _di_fake_build_load_setting_process_
-#ifndef _di_fake_build_load_setting_defaults_
- void fake_build_load_setting_defaults(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) {
+#ifndef _di_fake_build_load_setting_override_
+ void fake_build_load_setting_override(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) {
if (F_status_is_error(*status)) return;
- if (fake_signal_received(main)) {
- *status = F_status_set_error(F_interrupt);
-
- return;
- }
+ if (main->parameters.array[fake_parameter_path_sources_e].result == f_console_result_additional_e && main->path_sources.used) {
+ *status = f_string_dynamic_append_assure(f_path_separator_s, &main->path_sources);
- {
- const f_string_static_t sources[] = {
- fake_build_setting_default_version_s,
- fake_build_setting_default_version_s,
- fake_build_setting_default_version_s,
- };
-
- f_string_dynamic_t * const destinations[] = {
- &setting->version_major,
- &setting->version_minor,
- &setting->version_micro,
- };
-
- for (uint8_t i = 0; i < 3; ++i) {
-
- if (destinations[i]->used) continue;
+ if (F_status_is_error(*status)) {
+ fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true);
- *status = f_string_dynamic_append_assure(sources[i], destinations[i]);
+ return;
+ }
- if (F_status_is_error(*status)) {
- fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true);
- break;
- }
+ *status = f_string_dynamic_terminate_after(&main->path_sources);
- *status = f_string_dynamic_terminate_after(destinations[i]);
+ if (F_status_is_error(*status)) {
+ fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true);
- if (F_status_is_error(*status)) {
- fll_error_print(main->error, F_status_set_fine(*status), "f_string_dynamic_terminate_after", F_true);
- break;
- }
- } // for
+ return;
+ }
}
- if (F_status_is_error(*status)) return;
-
- // Override setting file when any of these are specified in the command line.
if (main->parameters.array[fake_parameter_shared_disabled_e].result == f_console_result_found_e) {
if (main->parameters.array[fake_parameter_shared_enabled_e].result == f_console_result_found_e) {
if (main->parameters.array[fake_parameter_shared_enabled_e].location > main->parameters.array[fake_parameter_shared_disabled_e].location) {
}
}
}
-#endif // _di_fake_build_load_setting_defaults_
+#endif // _di_fake_build_load_setting_override_
#ifndef _di_fake_build_load_stage_
void fake_build_load_stage(fake_main_t * const main, const f_string_static_t settings_file, fake_build_stage_t * const stage, f_status_t * const status) {
#endif // _di_fake_build_load_setting_
/**
- * Assign build setting defaults.
+ * Override build settings based on command line arguments.
*
* @param main
* The main program data.
*
* Status codes (with error bit) are returned on any problem.
*/
-#ifndef _di_fake_build_load_setting_defaults_
- extern void fake_build_load_setting_defaults(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) F_attribute_visibility_internal_d;
-#endif // _di_fake_build_load_setting_defaults_
+#ifndef _di_fake_build_load_setting_override_
+ extern void fake_build_load_setting_override(fake_main_t * const main, fake_build_setting_t * const setting, f_status_t * const status) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_load_setting_override_
/**
* Load and process the setting buffer.
f_string_static_t destination = f_string_static_t_initialize;
f_string_static_t source = f_string_static_t_initialize;
- const f_string_static_t *path_sources = &main->path_sources;
-
int result = main->child;
- if (data_build->setting.has_path_standard) {
- path_sources = &main->path_sources_c;
-
- if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
- path_sources = &main->path_sources_cpp;
- }
- }
- else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
- path_sources = &data_build->setting.path_sources;
- }
-
const f_string_dynamics_t *sources[2] = {
&data_build->setting.build_sources_library,
&data_build->setting.build_sources_library_static,
file_name.used = 0;
destination_path.used = 0;
- source.used = path_sources->used + sources[i]->array[j].used;
- char source_string[source.used + 1];
+ fake_build_path_source_length(main, data_build, &data_build->setting.path_sources_object, &source);
+
+ char source_string[source.used + sources[i]->array[j].used + 1];
source.string = source_string;
- source_string[source.used] = 0;
- memcpy(source_string, path_sources->string, path_sources->used);
- memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used);
+ fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source);
+
+ memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used);
+ source.used += sources[i]->array[j].used;
+ source.string[source.used] = 0;
*status = fake_build_get_file_name_without_extension(main, sources[i]->array[j], &file_name);
#endif // _di_fake_build_objects_add_
#ifndef _di_fake_build_operate_
- f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) {
+ f_status_t fake_build_operate(fake_main_t * const main, const f_string_static_t setting_file) {
if (fake_signal_received(main)) {
return F_status_set_error(F_interrupt);
fake_build_program_script(main, &data_build, mode, stage.file_program_script, &status);
if (data_build.setting.build_script) {
- fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
+ f_string_static_t source = f_string_static_t_initialize;
+
+ fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
+
+ char source_string[source.used + fake_path_part_script_s.used + 1];
+ source.string = source_string;
+
+ fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
+
+ memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used);
+ source.used += fake_path_part_script_s.used;
+ source.string[source.used] = 0;
+
+ fake_build_copy(main, mode, fake_build_scripts_s, source, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
}
}
else {
if (data_build.setting.build_sources_headers.used) {
- f_string_static_t path_sources = main->path_sources;
+ f_string_static_t source = f_string_static_t_initialize;
- if (data_build.setting.has_path_standard) {
- path_sources = main->path_sources_c;
+ fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
- if (data_build.setting.build_language == fake_build_language_type_cpp_e) {
- path_sources = main->path_sources_cpp;
- }
- }
- else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
- path_sources = data_build.setting.path_sources;
- }
+ char source_string[source.used + 1];
+ source.string = source_string;
+
+ fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
f_string_static_t path_headers = f_string_static_t_initialize;
path_headers.used = main->path_build_includes.used + data_build.setting.path_headers.used;
path_headers_string[path_headers.used] = 0;
- fake_build_copy(main, mode, fake_build_header_files_s, path_sources, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+ fake_build_copy(main, mode, fake_build_header_files_s, source, path_headers, data_build.setting.build_sources_headers, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
if (data_build.setting.build_shared) {
- fake_build_copy(main, mode, fake_build_header_files_shared_s, path_sources, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+ fake_build_copy(main, mode, fake_build_header_files_shared_s, source, path_headers, data_build.setting.build_sources_headers_shared, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
}
if (data_build.setting.build_static) {
- fake_build_copy(main, mode, fake_build_header_files_static_s, path_sources, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.preserve_path_headers ? path_sources.used : 0, &status);
+ fake_build_copy(main, mode, fake_build_header_files_static_s, source, path_headers, data_build.setting.build_sources_headers_static, stage.file_sources_headers, data_build.setting.preserve_path_headers ? source.used : 0, &status);
}
}
}
if (data_build.setting.build_script) {
- fake_build_copy(main, mode, fake_build_scripts_s, main->path_sources_script, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
+ f_string_static_t source = f_string_static_t_initialize;
+
+ fake_build_path_source_length(main, &data_build, &data_build.setting.path_sources, &source);
+
+ char source_string[source.used + fake_path_part_script_s.used + 1];
+ source.string = source_string;
+
+ fake_build_path_source_string(main, &data_build, &data_build.setting.path_sources, &source);
+
+ memcpy(source_string + source.used, fake_path_part_script_s.string, fake_path_part_script_s.used);
+ source.used += fake_path_part_script_s.used;
+ source.string[source.used] = 0;
+
+ fake_build_copy(main, mode, fake_build_scripts_s, source, main->path_build_programs_script, data_build.setting.build_sources_script, stage.file_sources_script, 0, &status);
}
}
}
#endif // _di_fake_build_operate_
+#ifndef _di_fake_build_path_source_length_
+ void fake_build_path_source_length(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) {
+
+ source->used = main->path_sources.used;
+
+ if (setting_path_source->used) {
+ source->used += setting_path_source->used;
+ }
+
+ if (data_build->setting.has_path_standard) {
+ if (data_build->setting.build_language == fake_build_language_type_c_e) {
+ source->used += fake_build_language_c_s.used;
+ }
+ else if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
+ source->used += fake_build_language_cpp_s.used;
+ }
+ else if (data_build->setting.build_language == fake_build_language_type_bash_e) {
+ source->used += fake_build_language_bash_s.used;
+ }
+
+ source->used += f_path_separator_s.used;
+ }
+ }
+#endif // _di_fake_build_path_source_length_
+
+#ifndef _di_fake_build_path_source_string_
+ void fake_build_path_source_string(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) {
+
+ source->used = 0;
+
+ memcpy(source->string, main->path_sources.string, main->path_sources.used);
+ source->used += main->path_sources.used;
+
+ memcpy(source->string + source->used, setting_path_source->string, setting_path_source->used);
+ source->used += setting_path_source->used;
+
+ if (data_build->setting.has_path_standard) {
+ if (data_build->setting.build_language == fake_build_language_type_c_e) {
+ memcpy(source->string + source->used, fake_build_language_c_s.string, fake_build_language_c_s.used);
+ source->used += fake_build_language_c_s.used;
+ }
+ else if (data_build->setting.build_language == fake_build_language_type_cpp_e) {
+ memcpy(source->string + source->used, fake_build_language_cpp_s.string, fake_build_language_cpp_s.used);
+ source->used += fake_build_language_cpp_s.used;
+ }
+ else if (data_build->setting.build_language == fake_build_language_type_bash_e) {
+ memcpy(source->string + source->used, fake_build_language_bash_s.string, fake_build_language_bash_s.used);
+ source->used += fake_build_language_bash_s.used;
+ }
+
+ memcpy(source->string + source->used, f_path_separator_s.string, f_path_separator_s.used);
+ source->used += f_path_separator_s.used;
+ }
+
+ source->string[source->used] = 0;
+ }
+#endif // _di_fake_build_path_source_string_
+
#ifndef _di_fake_build_sources_add_
f_status_t fake_build_sources_add(fake_main_t * const main, fake_build_data_t * const data_build, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) {
f_array_length_t i = 0;
f_array_length_t j = 0;
- f_string_static_t source = f_string_static_t_initialize;
-
- // @fixme review this, these paths (like path_sources_object) need to be build on a per-settings basis rather than using a global value.
- f_string_dynamic_t *path_sources = &main->path_sources;
const f_string_statics_t *sources[2] = {
generic,
specific,
};
- if (data_build->setting.has_path_standard) {
- if (data_build->setting.build_language == fake_build_language_type_c_e) {
- path_sources = &main->path_sources_c;
- }
- else {
- path_sources = &main->path_sources_cpp;
- }
- }
- else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
- path_sources = &data_build->setting.path_sources;
- }
+ f_string_static_t source = f_string_static_t_initialize;
for (; i < 2; ++i) {
if (!sources[i]->array[j].used) continue;
- source.used = path_sources->used + sources[i]->array[j].used;
+ fake_build_path_source_length(main, data_build, &data_build->setting.path_sources, &source);
- char source_string[source.used + 1];
+ char source_string[source.used + sources[i]->array[j].used + 1];
source.string = source_string;
- source_string[source.used] = 0;
- memcpy(source_string, path_sources->string, path_sources->used);
- memcpy(source_string + path_sources->used, sources[i]->array[j].string, sources[i]->array[j].used);
+ fake_build_path_source_string(main, data_build, &data_build->setting.path_sources, &source);
+
+ memcpy(source_string + source.used, sources[i]->array[j].string, sources[i]->array[j].used);
+ source.used += sources[i]->array[j].used;
+ source.string[source.used] = 0;
status = fll_execute_arguments_add(source, arguments);
if (F_status_is_error(status)) return status;
if (!generic->used && !specific->used) return F_none;
- f_status_t status = F_none;
-
f_string_static_t source = f_string_static_t_initialize;
- f_string_dynamic_t *path_sources = &main->path_sources_object;
- // @fixme review this, these paths (like path_sources_object) need to be build on a per-settings basis rather than using a global value.
- if (data_build->setting.has_path_standard) {
- if (data_build->setting.build_language == fake_build_language_type_c_e) {
- path_sources = &main->path_sources_object_c;
- }
- else {
- path_sources = &main->path_sources_object_cpp;
- }
- }
- else if (main->parameters.array[fake_parameter_path_sources_e].result != f_console_result_additional_e) {
- path_sources = &data_build->setting.path_sources_object;
- }
+ fake_build_path_source_length(main, data_build, &data_build->setting.path_sources_object, &source);
if (specific->used) {
- source.used = path_sources->used + specific->used;
+ source.used += specific->used;
}
else {
- source.used = path_sources->used + generic->used;
+ source.used += generic->used;
}
char source_string[source.used + 1];
source.string = source_string;
- source_string[source.used] = 0;
- memcpy(source_string, path_sources->string, path_sources->used);
+ fake_build_path_source_string(main, data_build, &data_build->setting.path_sources_object, &source);
if (specific->used) {
- memcpy(source_string + path_sources->used, specific->string, specific->used);
+ memcpy(source_string + source.used, specific->string, specific->used);
+ source.used += specific->used;
}
else {
- memcpy(source_string + path_sources->used, generic->string, generic->used);
+ memcpy(source_string + source.used, generic->string, generic->used);
+ source.used += generic->used;
}
- status = fll_execute_arguments_add(source, arguments);
+ source_string[source.used] = 0;
+
+ const f_status_t status = fll_execute_arguments_add(source, arguments);
if (F_status_is_error(status)) return status;
return F_none;
extern f_status_t fake_build_objects_add(fake_main_t * const main, fake_build_data_t * const data_build, const f_string_static_t *path, const f_string_statics_t *generic, const f_string_statics_t *specific, f_string_dynamics_t *arguments) F_attribute_visibility_internal_d;
#endif // _di_fake_build_objects_add_
-
/**
* Execute the build operation.
*
+ * @param main
+ * The main program data.
* @param setting_file
* The name of the settings file to use.
* If setting_file.used is 0, then the default or program parameter supplied file is used.
- * @param main
- * The main program data.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_build_operate_
- extern f_status_t fake_build_operate(const f_string_static_t setting_file, fake_main_t *main) F_attribute_visibility_internal_d;
+ extern f_status_t fake_build_operate(fake_main_t * const main, const f_string_static_t setting_file) F_attribute_visibility_internal_d;
#endif // _di_fake_build_operate_
/**
+ * Calculate the length of the sources path so that it can be used to manually construct a static string.
+ *
+ * @param main
+ * The main program data.
+ * @param data_build
+ * The build data.
+ * @param setting_path_source
+ * The source path from the build settings file.
+ * @param source
+ * The static string.
+ * The path_sources.string is not expected to be defined at this point.
+ * The path_sources.used is updated.
+ * The path_sources.size is ignored.
+ */
+#ifndef _di_fake_build_path_source_length_
+ extern void fake_build_path_source_length(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_path_source_length_
+
+/**
+ * Construct a static string array of the sources path.
+ *
+ * @param main
+ * The main program data.
+ * @param data_build
+ * The build data.
+ * @param setting_path_source
+ * The source path from the build settings file.
+ * @param source
+ * The static string.
+ * The path_sources.string is expected to be defined and set to a size from path_sources.used + 1.
+ * The path_sources.used is updated.
+ * The path_sources.size is ignored.
+ */
+#ifndef _di_fake_build_path_source_string_
+ extern void fake_build_path_source_string(fake_main_t * const main, fake_build_data_t * const data_build, f_string_static_t * const setting_path_source, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_build_path_source_string_
+
+/**
* Add the sources to the execute arguments array.
*
* @param main
const f_string_dynamic_t *parameters_source[] = {
&main->path_build,
&main->path_data,
- &main->path_sources,
- &main->path_sources_object,
};
const uint8_t parameters_size[] = {
7,
2,
- 4,
- 4,
};
f_string_dynamic_t *parameters_value_0[] = {
&main->path_data_settings,
};
- f_string_dynamic_t *parameters_value_2[] = {
- &main->path_sources_bash,
- &main->path_sources_c,
- &main->path_sources_cpp,
- &main->path_sources_script,
- };
-
- f_string_dynamic_t *parameters_value_3[] = {
- &main->path_sources_object_bash,
- &main->path_sources_object_c,
- &main->path_sources_object_cpp,
- &main->path_sources_object_script,
- };
-
f_string_dynamic_t **const parameters_value[] = {
parameters_value_0,
parameters_value_1,
- parameters_value_2,
- parameters_value_3,
};
- for (i = 0; i < 4; ++i) {
+ for (i = 0; i < 2; ++i) {
// Initialize all string lengths to 0.
for (uint8_t j = 0; j < parameters_size[i]; ++j) {
fake_path_part_settings_s,
fake_path_part_documents_s,
fake_path_part_licenses_s,
- fake_path_part_bash_s,
- fake_path_part_c_s,
- fake_path_part_cpp_s,
- fake_path_part_script_s,
- fake_path_part_bash_s,
- fake_path_part_c_s,
- fake_path_part_cpp_s,
- fake_path_part_script_s,
};
f_string_dynamic_t * const parameters_value[] = {
&main->path_data_settings,
&main->path_documents,
&main->path_licenses,
- &main->path_sources_bash,
- &main->path_sources_c,
- &main->path_sources_cpp,
- &main->path_sources_script,
- &main->path_sources_object_bash,
- &main->path_sources_object_c,
- &main->path_sources_object_cpp,
- &main->path_sources_object_script,
};
- for (i = 0; i < 19; ++i) {
+ for (i = 0; i < 11; ++i) {
status = f_string_dynamic_append_nulless(parameters_source[i], parameters_value[i]);
&main->path_build_stage,
&main->path_data_build,
&main->path_data_settings,
+ &main->path_documents,
&main->path_licenses,
- &main->path_sources_bash,
- &main->path_sources_c,
- &main->path_sources_cpp,
- &main->path_sources_script,
+ &main->path_sources,
&main->path_work_includes,
&main->path_work_libraries,
&main->path_work_libraries_script,
&main->path_work_programs_static,
&main->file_data_build_defines,
&main->file_data_build_dependencies,
+ &main->file_data_build_process_post_s,
+ &main->file_data_build_process_pre_s,
&main->file_data_build_fakefile,
&main->file_data_build_settings,
&main->file_documents_readme,
const uint8_t parameters_id[] = {
fake_parameter_path_build_e,
fake_parameter_path_data_e,
- fake_parameter_path_sources_e,
fake_parameter_path_work_e,
};
const f_string_static_t parameters_name[] = {
fake_long_path_build_s,
fake_long_path_data_s,
- fake_long_path_sources_s,
fake_long_path_work_s,
};
const f_string_static_t parameter_defaults[] = {
fake_default_path_build_s,
fake_default_path_data_s,
- fake_default_path_sources_s,
fake_default_path_work_s,
};
f_string_dynamic_t * const parameters_value[] = {
&main->path_build,
&main->path_data,
- &main->path_sources,
&main->path_work,
};
- for (uint8_t i = 0; i < 4; ++i) {
+ for (uint8_t i = 0; i < 3; ++i) {
if (main->parameters.array[parameters_id[i]].result == f_console_result_found_e) {
fake_print_error_parameter_missing_value(main, parameters_name[i]);
}
if (state_process->operation == fake_make_operation_type_build_e) {
- *status = fake_build_operate(arguments.used ? arguments.array[0] : f_string_empty_s, data_make->main);
+ *status = fake_build_operate(data_make->main, arguments.used ? arguments.array[0] : f_string_empty_s);
if (F_status_set_fine(*status) == F_interrupt) {
return 0;
if (main->output.verbosity != f_console_verbosity_quiet_e) {
fll_print_format("%rGenerating skeleton structure.%r", main->output.to.stream, f_string_eol_s, f_string_eol_s);
+
+ if (main->output.verbosity == f_console_verbosity_verbose_e) {
+ fll_print_dynamic(f_string_eol_s, main->output.to.stream);
+ }
}
{
- const f_string_dynamic_t *parameters_value[] = {
+ f_string_static_t sources = f_string_static_t_initialize;
+ f_string_static_t sources_bash = f_string_static_t_initialize;
+ f_string_static_t sources_c = f_string_static_t_initialize;
+ f_string_static_t sources_cpp = f_string_static_t_initialize;
+ f_string_static_t sources_script = f_string_static_t_initialize;
+
+ fake_skeleton_path_source_length(main, &f_string_empty_s, &sources);
+ fake_skeleton_path_source_length(main, &fake_path_part_bash_s, &sources_bash);
+ fake_skeleton_path_source_length(main, &fake_path_part_c_s, &sources_c);
+ fake_skeleton_path_source_length(main, &fake_path_part_cpp_s, &sources_cpp);
+ fake_skeleton_path_source_length(main, &fake_path_part_script_s, &sources_script);
+
+ char sources_string[sources.used + 1];
+ char sources_bash_string[sources_bash.used + 1];
+ char sources_c_string[sources_c.used + 1];
+ char sources_cpp_string[sources_cpp.used + 1];
+ char sources_script_string[sources_script.used + 1];
+
+ sources.string = sources_string;
+ sources_bash.string = sources_bash_string;
+ sources_c.string = sources_c_string;
+ sources_cpp.string = sources_cpp_string;
+ sources_script.string = sources_script_string;
+
+ fake_skeleton_path_source_string(main, &f_string_empty_s, &sources);
+ fake_skeleton_path_source_string(main, &fake_path_part_bash_s, &sources_bash);
+ fake_skeleton_path_source_string(main, &fake_path_part_c_s, &sources_c);
+ fake_skeleton_path_source_string(main, &fake_path_part_cpp_s, &sources_cpp);
+ fake_skeleton_path_source_string(main, &fake_path_part_script_s, &sources_script);
+
+ const f_string_static_t *parameters_value[] = {
&main->path_build,
&main->path_data,
&main->path_data_build,
&main->path_documents,
&main->path_licenses,
&main->path_sources,
- &main->path_sources_bash,
- &main->path_sources_c,
- &main->path_sources_cpp,
+ &sources,
+ &sources_bash,
+ &sources_c,
+ &sources_cpp,
+ &sources_script,
&main->path_work,
&main->path_work_includes,
&main->path_work_libraries,
&main->path_work_programs_script,
&main->path_work_programs_shared,
&main->path_work_programs_static,
+ &fake_path_part_specifications_s,
};
- for (uint8_t i = 0; i < 20; ++i) {
+ for (uint8_t i = 0; i < 23; ++i) {
status = fake_skeleton_operate_directory_create(main, *parameters_value[i]);
return status;
}
} // for
+
+ if (main->output.verbosity == f_console_verbosity_verbose_e) {
+ fll_print_dynamic(f_string_eol_s, main->output.to.stream);
+ }
}
if (F_status_is_error_not(status)) {
#endif // _di_fake_skeleton_operate_
#ifndef _di_fake_skeleton_operate_directory_create_
- f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_dynamic_t path) {
-
- f_status_t status = F_none;
+ f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_static_t path) {
if (!path.used) return F_none;
- status = f_directory_exists(path);
+ f_status_t status = f_directory_exists(path);
if (status == F_true) {
if (main->error.verbosity == f_console_verbosity_verbose_e) {
#endif // _di_fake_skeleton_operate_directory_create_
#ifndef _di_fake_skeleton_operate_file_create_
- f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) {
+ f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_static_t path, const bool executable, const f_string_static_t content) {
f_status_t status = F_none;
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_write", F_true, path, fake_common_file_populate_pre_s, fll_error_file_type_file_e);
f_file_stream_close(F_true, &file);
+
return status;
}
}
#endif // _di_fake_skeleton_operate_file_create_
+#ifndef _di_fake_skeleton_path_source_length_
+ void fake_skeleton_path_source_length(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) {
+
+ source->used = main->path_sources.used + fake_default_path_sources_s.used + partial->used;
+ }
+#endif // _di_fake_skeleton_path_source_length_
+
+#ifndef _di_fake_skeleton_path_source_string_
+ void fake_skeleton_path_source_string(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) {
+
+ source->used = 0;
+
+ memcpy(source->string, main->path_sources.string, main->path_sources.used);
+ source->used += main->path_sources.used;
+
+ memcpy(source->string, fake_default_path_sources_s.string, fake_default_path_sources_s.used);
+ source->used += fake_default_path_sources_s.used;
+
+ memcpy(source->string + source->used, partial->string, partial->used);
+ source->used += partial->used;
+
+ source->string[source->used] = 0;
+ }
+#endif // _di_fake_skeleton_path_source_string_
+
#ifdef __cplusplus
} // extern "C"
#endif
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_skeleton_operate_directory_create_
- extern f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_dynamic_t path) F_attribute_visibility_internal_d;
+ extern f_status_t fake_skeleton_operate_directory_create(fake_main_t * const main, const f_string_static_t path) F_attribute_visibility_internal_d;
#endif // _di_fake_skeleton_operate_directory_create_
/**
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_skeleton_operate_file_create_
- extern f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_dynamic_t path, const bool executable, const f_string_static_t content) F_attribute_visibility_internal_d;
+ extern f_status_t fake_skeleton_operate_file_create(fake_main_t * const main, const f_string_static_t path, const bool executable, const f_string_static_t content) F_attribute_visibility_internal_d;
#endif // _di_fake_skeleton_operate_file_create_
+/**
+ * Calculate the length of the sources path so that it can be used to manually construct a static string.
+ *
+ * @param main
+ * The main program data.
+ * @param partial
+ * The partial path string, such as "bash".
+ * @param source
+ * The static string.
+ * The path_sources.string is not expected to be defined at this point.
+ * The path_sources.used is updated.
+ * The path_sources.size is ignored.
+ */
+#ifndef _di_fake_skeleton_path_source_length_
+ extern void fake_skeleton_path_source_length(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_skeleton_path_source_length_
+
+/**
+ * Construct a static string array of the sources path.
+ *
+ * @param main
+ * The main program data.
+ * @param partial
+ * The partial path string, such as "bash".
+ * @param source
+ * The static string.
+ * The path_sources.string is expected to be defined and set to a size from path_sources.used + 1.
+ * The path_sources.used is updated.
+ * The path_sources.size is ignored.
+ */
+#ifndef _di_fake_skeleton_path_source_string_
+ extern void fake_skeleton_path_source_string(fake_main_t * const main, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d;
+#endif // _di_fake_skeleton_path_source_string_
+
#ifdef __cplusplus
} // extern "C"
#endif