From 05e16beb0cce74f3117cc4a06440374a7d36a7a7 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 28 Mar 2024 23:10:45 -0500 Subject: [PATCH] Bugfix: Problematic handling of object files. The object files are not being compiled correctly when performing a static build. There may now be multiple object sources files which are now built individually. The build object sources must be built without source code files. The logic is relocated into a fake_build_library_static_object() function to build the object files. These files are then included when static linking. A new build stage is also added to accommodate this. Building the objects should not include libraries linked. Remove the logic that auto-adds the library linkage when building objects. Break out the "path_sources" Object into multiple sub-parts: - "path_sources_headers". - "path_sources_library". - "path_sources_object". - "path_sources_program". - "path_sources_script". Update the documentation and specification files accordingly. Add missing version dates to the specifications. Update the bootstrap.sh script with these changes. Fix incidental problems discovered in the bootstrap.sh script: - Remove already compiled warning as it is not needed and is not exhaustive. - Improve handling of directory detection and simplify the relating code. - The built setting files are now being properly checked (a regression caused them to not be properly checked). --- build/scripts/bootstrap.sh | 583 +++++++++++---------- build/stand_alone/fake.settings | 2 +- level_3/fake/c/private-build-library.c | 219 +++++++- level_3/fake/c/private-build-library.h | 24 + level_3/fake/c/private-build-load.c | 251 ++++++--- level_3/fake/c/private-build-object.c | 227 ++++---- level_3/fake/c/private-build-object.h | 36 +- level_3/fake/c/private-build-objects.c | 220 -------- level_3/fake/c/private-build-objects.h | 46 -- level_3/fake/c/private-build-program.c | 6 +- level_3/fake/c/private-build.c | 80 ++- level_3/fake/c/private-build.h | 24 +- level_3/fake/c/private-common.c | 5 + level_3/fake/c/private-common.h | 56 +- level_3/fake/c/private-make-operate.c | 37 +- level_3/fake/c/private-skeleton.h | 12 +- level_3/fake/data/build/settings | 2 +- .../data/documentation/man/man5/fake-defines.5 | 2 +- .../data/documentation/man/man5/fake-depedencies.5 | 2 +- .../data/documentation/man/man5/fake-fakefile.5 | 2 +- .../data/documentation/man/man5/fake-settings.5 | 2 +- .../data/projects/example/return_code.fakefile | 2 +- level_3/fake/documents/fakefile.txt | 7 +- level_3/fake/documents/settings.txt | 70 ++- level_3/fake/specifications/defines.txt | 1 + level_3/fake/specifications/dependencies.txt | 1 + level_3/fake/specifications/fakefile.txt | 3 +- level_3/fake/specifications/settings.txt | 5 + 28 files changed, 1083 insertions(+), 844 deletions(-) delete mode 100644 level_3/fake/c/private-build-objects.c delete mode 100644 level_3/fake/c/private-build-objects.h diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index 6c87729..e3ec952 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -457,7 +457,7 @@ bootstrap_main() { echo -e "${c_highlight}Building:${c_reset} ${c_notice}${project_label}${c_highlight} with modes: ${c_notice}${modes}${c_highlight}.${c_reset}" fi - if [[ ! -f ${project_built}.prepared ]] ; then + if [[ ! -f ${project_built}-${settings_name}.prepared ]] ; then bootstrap_prepare_build if [[ ${?} -ne 0 ]] ; then @@ -673,159 +673,175 @@ bootstrap_id() { "path_program_shared") let key=69;; "path_program_static") let key=70;; "path_sources") let key=71;; - "path_sources_object") let key=72;; - "preserve_path_headers") let key=73;; - "process_post") let key=74;; - "process_pre") let key=75;; - "search_exclusive") let key=76;; - "search_shared") let key=77;; - "search_static") let key=78;; - "version_file") let key=79;; - "version_major") let key=80;; - "version_major_prefix") let key=81;; - "version_micro") let key=82;; - "version_micro_prefix") let key=83;; - "version_minor") let key=84;; - "version_minor_prefix") let key=85;; - "version_nano") let key=86;; - "version_nano_prefix") let key=87;; - "version_target") let key=88;; - - "build_compiler-mode") let key=89;; - "build_indexer-mode") let key=90;; - "build_indexer_arguments-mode") let key=91;; - "build_language-mode") let key=92;; - "build_libraries-mode") let key=93;; - "build_libraries_shared-mode") let key=94;; - "build_libraries_static-mode") let key=95;; - "build_name-mode") let key=96;; - "build_objects_library-mode") let key=97;; - "build_objects_library_shared-mode") let key=98;; - "build_objects_library_static-mode") let key=99;; - "build_objects_program-mode") let key=100;; - "build_objects_program_shared-mode") let key=101;; - "build_objects_program_static-mode") let key=102;; - "build_script-mode") let key=103;; - "build_shared-mode") let key=104;; - "build_sources_documentation-mode") let key=105;; - "build_sources_headers-mode") let key=106;; - "build_sources_headers_shared-mode") let key=107;; - "build_sources_headers_static-mode") let key=108;; - "build_sources_library-mode") let key=109;; - "build_sources_library_shared-mode") let key=110;; - "build_sources_library_static-mode") let key=111;; - "build_sources_object-mode") let key=112;; - "build_sources_object_shared-mode") let key=113;; - "build_sources_object_static-mode") let key=114;; - "build_sources_program-mode") let key=115;; - "build_sources_program_shared-mode") let key=116;; - "build_sources_program_static-mode") let key=117;; - "build_sources_script-mode") let key=118;; - "build_sources_setting-mode") let key=119;; - "build_static-mode") let key=120;; - "defines-mode") let key=121;; - "defines_library-mode") let key=122;; - "defines_library_shared-mode") let key=123;; - "defines_library_static-mode") let key=124;; - "defines_object-mode") let key=125;; - "defines_object_shared-mode") let key=126;; - "defines_object_static-mode") let key=127;; - "defines_program-mode") let key=128;; - "defines_program_shared-mode") let key=129;; - "defines_program_static-mode") let key=130;; - "defines_shared-mode") let key=131;; - "defines_static-mode") let key=132;; - "environment-mode") let key=133;; - "flags-mode") let key=134;; - "flags_library-mode") let key=135;; - "flags_library_shared-mode") let key=136;; - "flags_library_static-mode") let key=137;; - "flags_object-mode") let key=138;; - "flags_object_shared-mode") let key=139;; - "flags_object_static-mode") let key=140;; - "flags_program-mode") let key=141;; - "flags_program_shared-mode") let key=142;; - "flags_program_static-mode") let key=143;; - "flags_shared-mode") let key=144;; - "flags_static-mode") let key=145;; - "has_path_standard-mode") let key=146;; - "path_headers-mode") let key=147;; - "path_language-mode") let key=148;; - "path_library_script-mode") let key=149;; - "path_library_shared-mode") let key=150;; - "path_library_static-mode") let key=151;; - "path_object_script-mode") let key=152;; - "path_object_shared-mode") let key=153;; - "path_object_static-mode") let key=154;; - "path_program_script-mode") let key=155;; - "path_program_shared-mode") let key=156;; - "path_program_static-mode") let key=157;; - "path_sources-mode") let key=158;; - "path_sources_object-mode") let key=159;; - "preserve_path_headers-mode") let key=160;; - "process_post-mode") let key=161;; - "process_pre-mode") let key=162;; - "search_exclusive-mode") let key=163;; - "search_shared-mode") let key=164;; - "search_static-mode") let key=165;; - "version_file-mode") let key=166;; - "version_major-mode") let key=167;; - "version_major_prefix-mode") let key=168;; - "version_micro-mode") let key=169;; - "version_micro_prefix-mode") let key=170;; - "version_minor-mode") let key=171;; - "version_minor_prefix-mode") let key=172;; - "version_nano-mode") let key=173;; - "version_nano_prefix-mode") let key=174;; - "version_target-mode") let key=175;; - - "has-build_compiler") let key=176;; - "has-build_indexer") let key=177;; - "has-build_indexer_arguments") let key=178;; - "has-build_name") let key=179;; - "has-has_path_standard") let key=180;; - "has-path_library_script") let key=181;; - "has-path_library_shared") let key=182;; - "has-path_library_static") let key=183;; - "has-path_object_script") let key=184;; - "has-path_object_shared") let key=185;; - "has-path_object_static") let key=186;; - "has-path_program_script") let key=187;; - "has-path_program_shared") let key=188;; - "has-path_program_static") let key=189;; - "has-path_sources") let key=190;; - "has-path_sources_object") let key=191;; - "has-search_exclusive") let key=192;; - "has-search_shared") let key=193;; - "has-search_static") let key=194;; - "has-version_major_prefix") let key=195;; - "has-version_micro_prefix") let key=196;; - "has-version_minor_prefix") let key=197;; - "has-version_nano_prefix") let key=198;; - - "has-build_compiler-mode") let key=199;; - "has-build_indexer-mode") let key=200;; - "has-build_indexer_arguments-mode") let key=201;; - "has-build_name-mode") let key=202;; - "has-has_path_standard-mode") let key=203;; - "has-path_library_script-mode") let key=204;; - "has-path_library_shared-mode") let key=205;; - "has-path_library_static-mode") let key=206;; - "has-path_object_script-mode") let key=207;; - "has-path_object_shared-mode") let key=208;; - "has-path_object_static-mode") let key=209;; - "has-path_program_script-mode") let key=210;; - "has-path_program_shared-mode") let key=211;; - "has-path_program_static-mode") let key=212;; - "has-path_sources-mode") let key=213;; - "has-path_sources_object-mode") let key=214;; - "has-search_exclusive-mode") let key=215;; - "has-search_shared-mode") let key=216;; - "has-search_static-mode") let key=217;; - "has-version_major_prefix-mode") let key=218;; - "has-version_micro_prefix-mode") let key=219;; - "has-version_minor_prefix-mode") let key=220;; - "has-version_nano_prefix-mode") let key=221;; + "path_sources_headers") let key=72;; + "path_sources_library") let key=73;; + "path_sources_object") let key=74;; + "path_sources_program") let key=75;; + "path_sources_script") let key=76;; + "preserve_path_headers") let key=77;; + "process_post") let key=78;; + "process_pre") let key=79;; + "search_exclusive") let key=80;; + "search_shared") let key=81;; + "search_static") let key=82;; + "version_file") let key=83;; + "version_major") let key=84;; + "version_major_prefix") let key=85;; + "version_micro") let key=86;; + "version_micro_prefix") let key=87;; + "version_minor") let key=88;; + "version_minor_prefix") let key=89;; + "version_nano") let key=90;; + "version_nano_prefix") let key=91;; + "version_target") let key=92;; + + "build_compiler-mode") let key=93;; + "build_indexer-mode") let key=94;; + "build_indexer_arguments-mode") let key=95;; + "build_language-mode") let key=96;; + "build_libraries-mode") let key=97;; + "build_libraries_shared-mode") let key=98;; + "build_libraries_static-mode") let key=99;; + "build_name-mode") let key=100;; + "build_objects_library-mode") let key=101;; + "build_objects_library_shared-mode") let key=102;; + "build_objects_library_static-mode") let key=103;; + "build_objects_program-mode") let key=104;; + "build_objects_program_shared-mode") let key=105;; + "build_objects_program_static-mode") let key=106;; + "build_script-mode") let key=107;; + "build_shared-mode") let key=108;; + "build_sources_documentation-mode") let key=109;; + "build_sources_headers-mode") let key=110;; + "build_sources_headers_shared-mode") let key=111;; + "build_sources_headers_static-mode") let key=112;; + "build_sources_library-mode") let key=113;; + "build_sources_library_shared-mode") let key=114;; + "build_sources_library_static-mode") let key=115;; + "build_sources_object-mode") let key=116;; + "build_sources_object_shared-mode") let key=117;; + "build_sources_object_static-mode") let key=118;; + "build_sources_program-mode") let key=119;; + "build_sources_program_shared-mode") let key=120;; + "build_sources_program_static-mode") let key=121;; + "build_sources_script-mode") let key=122;; + "build_sources_setting-mode") let key=123;; + "build_static-mode") let key=124;; + "defines-mode") let key=125;; + "defines_library-mode") let key=126;; + "defines_library_shared-mode") let key=127;; + "defines_library_static-mode") let key=128;; + "defines_object-mode") let key=129;; + "defines_object_shared-mode") let key=130;; + "defines_object_static-mode") let key=131;; + "defines_program-mode") let key=132;; + "defines_program_shared-mode") let key=133;; + "defines_program_static-mode") let key=134;; + "defines_shared-mode") let key=135;; + "defines_static-mode") let key=136;; + "environment-mode") let key=137;; + "flags-mode") let key=138;; + "flags_library-mode") let key=139;; + "flags_library_shared-mode") let key=140;; + "flags_library_static-mode") let key=141;; + "flags_object-mode") let key=142;; + "flags_object_shared-mode") let key=143;; + "flags_object_static-mode") let key=144;; + "flags_program-mode") let key=145;; + "flags_program_shared-mode") let key=146;; + "flags_program_static-mode") let key=147;; + "flags_shared-mode") let key=148;; + "flags_static-mode") let key=149;; + "has_path_standard-mode") let key=150;; + "path_headers-mode") let key=151;; + "path_language-mode") let key=152;; + "path_library_script-mode") let key=153;; + "path_library_shared-mode") let key=154;; + "path_library_static-mode") let key=155;; + "path_object_script-mode") let key=156;; + "path_object_shared-mode") let key=157;; + "path_object_static-mode") let key=158;; + "path_program_script-mode") let key=159;; + "path_program_shared-mode") let key=160;; + "path_program_static-mode") let key=161;; + "path_sources-mode") let key=162;; + "path_sources_headers-mode") let key=163;; + "path_sources_library-mode") let key=164;; + "path_sources_object-mode") let key=165;; + "path_sources_program-mode") let key=166;; + "path_sources_script-mode") let key=167;; + "preserve_path_headers-mode") let key=168;; + "process_post-mode") let key=169;; + "process_pre-mode") let key=170;; + "search_exclusive-mode") let key=171;; + "search_shared-mode") let key=172;; + "search_static-mode") let key=173;; + "version_file-mode") let key=174;; + "version_major-mode") let key=175;; + "version_major_prefix-mode") let key=176;; + "version_micro-mode") let key=177;; + "version_micro_prefix-mode") let key=178;; + "version_minor-mode") let key=179;; + "version_minor_prefix-mode") let key=180;; + "version_nano-mode") let key=181;; + "version_nano_prefix-mode") let key=182;; + "version_target-mode") let key=183;; + + "has-build_compiler") let key=184;; + "has-build_indexer") let key=185;; + "has-build_indexer_arguments") let key=186;; + "has-build_name") let key=187;; + "has-has_path_standard") let key=188;; + "has-path_library_script") let key=189;; + "has-path_library_shared") let key=190;; + "has-path_library_static") let key=191;; + "has-path_object_script") let key=192;; + "has-path_object_shared") let key=193;; + "has-path_object_static") let key=194;; + "has-path_program_script") let key=195;; + "has-path_program_shared") let key=196;; + "has-path_program_static") let key=197;; + "has-path_sources") let key=198;; + "has-path_sources_headers") let key=199;; + "has-path_sources_library") let key=200;; + "has-path_sources_object") let key=201;; + "has-path_sources_program") let key=202;; + "has-path_sources_script") let key=203;; + "has-search_exclusive") let key=204;; + "has-search_shared") let key=205;; + "has-search_static") let key=206;; + "has-version_major_prefix") let key=207;; + "has-version_micro_prefix") let key=208;; + "has-version_minor_prefix") let key=209;; + "has-version_nano_prefix") let key=210;; + + "has-build_compiler-mode") let key=207;; + "has-build_indexer-mode") let key=208;; + "has-build_indexer_arguments-mode") let key=209;; + "has-build_name-mode") let key=210;; + "has-has_path_standard-mode") let key=211;; + "has-path_library_script-mode") let key=212;; + "has-path_library_shared-mode") let key=213;; + "has-path_library_static-mode") let key=214;; + "has-path_object_script-mode") let key=215;; + "has-path_object_shared-mode") let key=216;; + "has-path_object_static-mode") let key=217;; + "has-path_program_script-mode") let key=218;; + "has-path_program_shared-mode") let key=219;; + "has-path_program_static-mode") let key=220;; + "has-path_sources-mode") let key=221;; + "has-path_sources_headers-mode") let key=222;; + "has-path_sources_library-mode") let key=223;; + "has-path_sources_object-mode") let key=224;; + "has-path_sources_program-mode") let key=225;; + "has-path_sources_script-mode") let key=226;; + "has-search_exclusive-mode") let key=227;; + "has-search_shared-mode") let key=228;; + "has-search_static-mode") let key=229;; + "has-version_major_prefix-mode") let key=230;; + "has-version_micro_prefix-mode") let key=231;; + "has-version_minor_prefix-mode") let key=232;; + "has-version_nano_prefix-mode") let key=233;; esac } @@ -870,7 +886,7 @@ bootstrap_load_settings() { fi # Single value Objects. - for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do + for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do bootstrap_id "${i}" @@ -965,7 +981,7 @@ bootstrap_load_settings_mode() { for m in ${modes} ; do # Single value Objects. - for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_object preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do + for i in build_compiler build_indexer build_language build_name build_script build_shared build_sources_object build_sources_object_shared build_sources_object_static build_static has_path_standard path_headers path_language path_library_script path_library_shared path_library_static path_object_script path_object_shared path_object_static path_program_script path_program_shared path_program_static path_sources path_sources_headers path_sources_library path_sources_object path_sources_program path_sources_script preserve_path_headers process_post process_pre search_exclusive search_shared search_static version_file version_major version_major_prefix version_micro version_micro_prefix version_minor version_minor_prefix version_nano version_nano_prefix version_target ; do bootstrap_id "${i}-mode" @@ -1254,6 +1270,21 @@ bootstrap_operation_build() { bootstrap_id "path_program_static" local path_program_static=${variables[${key}]} + bootstrap_id "path_sources_headers" + local path_sources_headers=${variables[${key}]} + + bootstrap_id "path_sources_library" + local path_sources_library=${variables[${key}]} + + bootstrap_id "path_sources_object" + local path_sources_object=${variables[${key}]} + + bootstrap_id "path_sources_program" + local path_sources_program=${variables[${key}]} + + bootstrap_id "path_sources_script" + local path_sources_script=${variables[${key}]} + bootstrap_id "has_path_standard" local has_path_standard=${variables[${key}]} @@ -1364,14 +1395,6 @@ bootstrap_operation_build() { bootstrap_operation_build_prepare_remaining - if [[ ${build_shared} == "yes" && -f ${project_built_shared}.built || ${build_static} == "yes" && -f ${project_built_static}.built ]] ; then - if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then - echo -e "${c_warning}WARNING: This project has already been built.${c_reset}" - fi - - return 0 - fi - local arguments_include="-I${path_build}includes/" local arguments_shared="-L${path_build}libraries/${path_library_shared}" local arguments_static="-L${path_build}libraries/${path_library_static}" @@ -1398,7 +1421,13 @@ bootstrap_operation_build() { if [[ ${sources_documentation} != "" ]] ; then for i in ${sources_documentation} ; do + directory=$(dirname ${i}) + if [[ ${directory} == "." ]] ; then + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" + fi if [[ ! -e ${path_documentation}${i} ]] ; then if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then @@ -1409,30 +1438,32 @@ bootstrap_operation_build() { continue; fi - if [[ ${directory} == "." ]] ; then - cp ${verbose_common} -R ${path_documentation}${i} ${path_build}documentation/ || failure=1 - else + if [[ ! -d ${path_build}documentation/${directory} ]] ; then mkdir ${verbose_common} -p ${path_build}documentation/${directory} || failure=1 + fi - if [[ ${failure} -eq 0 ]] ; then - cp ${verbose_common} -R ${path_documentation}${i} ${path_build}documentation/${directory}/ || failure=1 - fi + if [[ ${failure} -eq 0 ]] ; then + cp ${verbose_common} -R ${path_documentation}${i} ${path_build}documentation/${directory} || failure=1 fi done fi if [[ ${sources_setting} != "" ]] ; then for i in ${sources_setting} ; do - directory=$(dirname ${i}) + directory=$(dirname ${i}) if [[ ${directory} == "." ]] ; then - cp ${verbose_common} -R ${path_settings}${i} ${path_build}settings/ || failure=1 - else + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" + fi + + if [[ ! -d ${path_build}settings/${directory} ]] ; then mkdir ${verbose_common} -p ${path_build}settings/${directory} || failure=1 + fi - if [[ ${failure} -eq 0 ]] ; then - cp ${verbose_common} -R ${path_settings}${i} ${path_build}settings/${directory}/ || failure=1 - fi + if [[ ${failure} -eq 0 ]] ; then + cp ${verbose_common} -R ${path_settings}${i} ${path_build}settings/${directory} || failure=1 fi done fi @@ -1440,75 +1471,60 @@ bootstrap_operation_build() { if [[ ${failure} -eq 0 && ${sources_headers} != "" ]] ; then if [[ ${preserve_path_headers} == "yes" ]] ; then for i in ${sources_headers} ; do - directory=$(dirname ${i}) + directory=$(dirname ${i}) if [[ ${directory} == "." ]] ; then - cp ${verbose_common} -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers} || failure=1 - else - if [[ ! -d ${path_build}includes/${path_headers}${directory} ]] ; then - mkdir ${verbose_common} -p ${path_build}includes/${path_headers}${directory} || failure=1 - fi + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" + fi - if [[ ${failure} -eq 0 ]] ; then - cp ${verbose_common} -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers}${i} || failure=1 - fi + if [[ ! -d ${path_build}includes/${path_headers}${directory} ]] ; then + mkdir ${verbose_common} -p ${path_build}includes/${path_headers}${directory} || failure=1 + fi + + if [[ ${failure} -eq 0 ]] ; then + cp ${verbose_common} -f ${path_sources_headers}${path_language}${i} ${path_build}includes/${path_headers}${directory} || failure=1 fi done else for i in ${sources_headers} ; do - cp ${verbose_common} -f ${path_sources}${path_language}${i} ${path_build}includes/${path_headers} || failure=1 + cp ${verbose_common} -f ${path_sources_headers}${path_language}${i} ${path_build}includes/${path_headers} || failure=1 done fi fi - if [[ ${failure} -eq 0 && ${build_shared} == "yes" && ! -f ${project_built_shared}.built ]] ; then + if [[ ${failure} -eq 0 && ${build_shared} == "yes" && ! -f ${project_built_shared}-${settings_name}.built ]] ; then if [[ ${sources_object} != "" || ${sources_object_shared} != "" ]] ; then - sources= - let count=0 - - # Sources object only allows for a single value. - if [[ ${sources_object_shared} != "" ]] ; then - for i in ${sources_object_shared} ; do - let count++ - done + for i in ${sources_object} ${sources_object_shared} ; do - if [[ ${count} -gt 1 ]] ; then - if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_shared${c_warning}' found, only using the first one found is going to be used.${c_reset}" - fi + directory=$(dirname ${i}) + if [[ ${directory} == "." ]] ; then + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" fi - for i in ${sources_object_shared} ; do - sources="${path_sources_object}${path_language}${i} " + if [[ ! -d ${path_build}objects/${path_object_shared}${directory} ]] ; then + mkdir ${verbose_common} -p ${path_build}objects/${path_object_shared}${directory} || failure=1 + fi - break - done - else - for i in ${sources_object} ; do - let count++ - done + sources="${path_sources_object}${path_language}${i} " + n=$(echo $i | sed -e 's|\.[^\.]*$||') - if [[ ${count} -gt 1 ]] ; then - if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object${c_warning}' found, only using the first one found is going to be used.${c_reset}" - fi + if [[ ${verbosity} == "verbose" ]] ; then + echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_shared}${n}.o ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_object} ${flags_object_shared} ${defines} ${defines_shared} ${defines_object} ${defines_object_shared} ${define_extra} fi - for i in ${sources_object} ; do - sources="${path_sources_object}${path_language}${i} " + ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_shared}${n}.o ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_object} ${flags_object_shared} ${defines} ${defines_shared} ${defines_object} ${defines_object_shared} ${define_extra} || failure=1 + if [[ ${failure} -ne 0 ]] ; then break - done - fi - - if [[ ${verbosity} == "verbose" ]] ; then - echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_shared}${build_name}.o ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_object} ${flags_object_shared} ${defines} ${defines_shared} ${defines_object} ${defines_object_shared} ${define_extra} - fi - - ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_shared}${build_name}.o ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_object} ${flags_object_shared} ${defines} ${defines_shared} ${defines_object} ${defines_object_shared} ${define_extra} || failure=1 + fi + done fi - if [[ ${sources_library} != "" || ${sources_library_shared} != "" ]] ; then + if [[ ${failure} -eq 0 && (${sources_library} != "" || ${sources_library_shared} != "") ]] ; then sources= if [[ ${objects_library} != "" || ${objects_library_shared} != "" ]] ; then @@ -1518,7 +1534,7 @@ bootstrap_operation_build() { fi for i in ${sources_library} ${sources_library_shared} ; do - sources="${sources}${path_sources}${path_language}${i} " + sources="${sources}${path_sources_library}${path_language}${i} " done if [[ ${verbosity} == "verbose" ]] ; then @@ -1554,7 +1570,7 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} -eq 0 && ${sources_program} != "" ]] ; then + if [[ ${failure} -eq 0 && (${sources_program} != "" || ${sources_program_shared} != "") ]] ; then sources= links= @@ -1569,7 +1585,7 @@ bootstrap_operation_build() { fi for i in ${sources_program} ${sources_program_shared} ; do - sources="${sources}${path_sources}${path_language}${i} " + sources="${sources}${path_sources_program}${path_language}${i} " done if [[ ${verbosity} == "verbose" ]] ; then @@ -1584,50 +1600,34 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} -eq 0 && ${build_static} == "yes" && ! -f ${project_built_static}.built ]] ; then + if [[ ${failure} -eq 0 && ${build_static} == "yes" && ! -f ${project_built_static}-${settings_name}.built ]] ; then if [[ ${sources_object} != "" || ${sources_object_static} != "" ]] ; then - let count=0 + for i in ${sources_object} ${sources_object_static} ; do - # Sources object only allows for a single value. - if [[ ${sources_object_static} != "" ]] ; then - for i in ${sources_object_static} ; do - let count++ - done + directory=$(dirname ${i}) + if [[ ${directory} == "." ]] ; then + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" + fi - if [[ ${count} -gt 1 ]] ; then - if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object_static${c_warning}' found, only using the first one found is going to be used.${c_reset}" - fi + if [[ ! -d ${path_build}objects/${path_object_shared}${directory} ]] ; then + mkdir ${verbose_common} -p ${path_build}objects/${path_object_shared}${directory} || failure=1 fi - for i in ${sources_object_static} ; do - sources="${path_sources_object}${path_language}${i} " + sources="${path_sources_object}${path_language}${i} " + n=$(echo $i | sed -e 's|\.[^\.]*$||') - break - done - else - for i in ${sources_object} ; do - let count++ - done - - if [[ ${count} -gt 1 ]] ; then - if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then - echo -e "${c_warning}WARNING: Multiple '${c_notice}sources_object${c_warning}' found, only using the first one found is going to be used.${c_reset}" - fi + if [[ ${verbosity} == "verbose" ]] ; then + echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_static}${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_object} ${flags_object_static} ${defines} ${defines_static} ${defines_object} ${defines_object_static} ${define_extra} fi - for i in ${sources_object} ; do - sources="${path_sources_object}${path_language}${i} " + ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_static}${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_object} ${flags_object_static} ${defines} ${defines_static} ${defines_object} ${defines_object_static} ${define_extra} || failure=1 + if [[ ${failure} -ne 0 ]] ; then break - done - fi - - if [[ ${verbosity} == "verbose" ]] ; then - echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_static}${build_name}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_object} ${flags_object_static} ${defines} ${defines_static} ${defines_object} ${defines_object_static} ${define_extra} - fi - - ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_static}${build_name}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_object} ${flags_object_static} ${defines} ${defines_static} ${defines_object} ${defines_object_static} ${define_extra} || failure=1 + fi + done fi if [[ ${sources_library} != "" || ${sources_library_static} != "" ]] ; then @@ -1640,27 +1640,32 @@ bootstrap_operation_build() { fi for i in ${sources_library} ${sources_library_static} ; do + directory=$(dirname ${i}) - n=$(basename ${i} | sed -e 's|\.c$||') + if [[ ${directory} == "." ]] ; then + directory= + elif [[ ${directory} != "" ]] ; then + directory="${directory}/" + fi - if [[ ${directory} != "." && ! -d ${path_build}objects/${directory} ]] ; then - mkdir ${verbose_common} -p ${path_build}objects/${directory} + n=$(basename ${i} | sed -e 's|\.[^\.]*$||') - if [[ ${?} -ne 0 ]] ; then - let failure=1 + if [[ ! -d ${path_build}objects/${directory} ]] ; then + mkdir ${verbose_common} -p ${path_build}objects/${directory} || failure=1 + if [[ ${failure} -eq 1 ]] ; then break; fi fi # These are objects created by the static build step rather than objects created by the object build step. - sources="${sources}${path_build}objects/${directory}/${n}.o " + sources="${sources}${path_build}objects/${directory}${n}.o " if [[ ${verbosity} == "verbose" ]] ; then - echo ${build_compiler} ${path_sources}${path_language}${i} -c -static -o ${path_build}objects/${directory}/${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_library} ${flags_library_static} ${defines} ${defines_static} ${defines_library} ${defines_library_static} ${define_extra} + echo ${build_compiler} ${path_sources_library}${path_language}${i} -c -static -o ${path_build}objects/${directory}${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_library} ${flags_library_static} ${defines} ${defines_static} ${defines_library} ${defines_library_static} ${define_extra} fi - ${build_compiler} ${path_sources}${path_language}${i} -c -static -o ${path_build}objects/${directory}/${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_library} ${flags_library_static} ${defines} ${defines_static} ${defines_library} ${defines_library_static} ${define_extra} || failure=1 + ${build_compiler} ${path_sources_library}${path_language}${i} -c -static -o ${path_build}objects/${directory}${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_library} ${flags_library_static} ${defines} ${defines_static} ${defines_library} ${defines_library_static} ${define_extra} || failure=1 if [[ ${failure} -eq 1 ]] ; then break; @@ -1677,7 +1682,7 @@ bootstrap_operation_build() { fi fi - if [[ ${failure} -eq 0 && ${sources_program} != "" ]] ; then + if [[ ${failure} -eq 0 && (${sources_program} != "" || ${sources_program_static} != "") ]] ; then sources= links= @@ -1692,7 +1697,7 @@ bootstrap_operation_build() { fi for i in ${sources_program} ${sources_program_static} ; do - sources="${sources}${path_sources}${path_language}${i} " + sources="${sources}${path_sources_program}${path_language}${i} " done if [[ ${verbosity} == "verbose" ]] ; then @@ -1873,12 +1878,48 @@ bootstrap_operation_build_prepare_defaults() { fi fi + bootstrap_id "has-path_sources_headers-mode" + if [[ ${variables[${key}]} != "yes" ]] ; then + + bootstrap_id "has-path_sources_headers" + if [[ ${variables[${key}]} != "yes" ]] ; then + path_sources_headers=${path_sources} + fi + fi + + bootstrap_id "has-path_sources_library-mode" + if [[ ${variables[${key}]} != "yes" ]] ; then + + bootstrap_id "has-path_sources_library" + if [[ ${variables[${key}]} != "yes" ]] ; then + path_sources_library=${path_sources} + fi + fi + bootstrap_id "has-path_sources_object-mode" if [[ ${variables[${key}]} != "yes" ]] ; then bootstrap_id "has-path_sources_object" if [[ ${variables[${key}]} != "yes" ]] ; then - path_sources_object="sources/" + path_sources_object=${path_sources} + fi + fi + + bootstrap_id "has-path_sources_program-mode" + if [[ ${variables[${key}]} != "yes" ]] ; then + + bootstrap_id "has-path_sources_program" + if [[ ${variables[${key}]} != "yes" ]] ; then + path_sources_program=${path_sources} + fi + fi + + bootstrap_id "has-path_sources_script-mode" + if [[ ${variables[${key}]} != "yes" ]] ; then + + bootstrap_id "has-path_sources_script" + if [[ ${variables[${key}]} != "yes" ]] ; then + path_sources_script=${path_sources} fi fi @@ -3038,7 +3079,7 @@ bootstrap_operation_clean() { fi done - if [[ -f ${project_built}.prepared ]] ; then + if [[ -f ${project_built}-${settings_name}.prepared ]] ; then rm ${verbose_common} -f ${project_built}-${settings_name}.prepared fi diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 837638b..63c550f 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -76,7 +76,7 @@ build_sources_program fll/level_2/print.c build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/level_2/private-program.c build_sources_program program/fake/fake.c program/fake/common.c -build_sources_program program/fake/private-build.c program/fake/private-build-library.c program/fake/private-build-load.c program/fake/private-build-object.c program/fake/private-build-objects.c program/fake/private-build-program.c program/fake/private-build-skeleton.c +build_sources_program program/fake/private-build.c program/fake/private-build-library.c program/fake/private-build-load.c program/fake/private-build-object.c program/fake/private-build-program.c program/fake/private-build-skeleton.c build_sources_program program/fake/private-clean.c program/fake/private-common.c program/fake/private-make.c program/fake/private-print.c program/fake/private-skeleton.c build_sources_program program/fake/private-make-load_fakefile.c program/fake/private-make-load_parameters.c build_sources_program program/fake/private-make-operate.c program/fake/private-make-operate_block.c program/fake/private-make-operate_process.c program/fake/private-make-operate_process_type.c program/fake/private-make-operate_validate.c program/fake/private-make-operate_validate_type.c diff --git a/level_3/fake/c/private-build-library.c b/level_3/fake/c/private-build-library.c index 314f945..5d5ef4a 100644 --- a/level_3/fake/c/private-build-library.c +++ b/level_3/fake/c/private-build-library.c @@ -42,7 +42,7 @@ extern "C" { return 0; } - *status = fake_build_sources_add(data, data_build, &data_build->setting.build_sources_library, &data_build->setting.build_sources_library_shared, &arguments); + *status = fake_build_sources_add(data, data_build, &data_build->setting.path_sources_library, &data_build->setting.build_sources_library, &data_build->setting.build_sources_library_shared, &arguments); if (F_status_is_error(*status)) { fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_add", F_true); @@ -493,6 +493,14 @@ extern "C" { } if (F_status_is_error_not(*status)) { + *status = fake_build_objects_add(data, data_build, &data->path_build_objects_static, &data_build->setting.build_objects_library, &data_build->setting.build_objects_library_static, &arguments); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_objects_add", F_true); + } + } + + if (F_status_is_error_not(*status)) { f_string_static_t source = f_string_static_t_initialize; f_array_length_t j = 0; @@ -506,6 +514,7 @@ extern "C" { for (j = 0; j < sources[i]->used; ++j) { source_path.used = 0; + file_name.used = 0; *status = fake_build_get_file_name_without_extension(data, sources[i]->array[j], &file_name); @@ -524,7 +533,7 @@ extern "C" { } if (source_path.used) { - *status = f_string_dynamic_prepend(data->path_build_objects, &source_path); + *status = f_string_dynamic_prepend(data->path_build_objects_static, &source_path); if (F_status_is_error(*status)) { fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); @@ -543,7 +552,7 @@ extern "C" { source.used = source_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } else { - source.used = data->path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; + source.used = data->path_build_objects_static.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; } f_char_t source_string[source.used + 1]; @@ -556,9 +565,9 @@ extern "C" { memcpy(source_string + source_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); } else { - memcpy(source_string, data->path_build_objects.string, sizeof(f_char_t) * data->path_build_objects.used); - memcpy(source_string + data->path_build_objects.used, file_name.string, sizeof(f_char_t) * file_name.used); - memcpy(source_string + data->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); + memcpy(source_string, data->path_build_objects_static.string, sizeof(f_char_t) * data->path_build_objects_static.used); + memcpy(source_string + data->path_build_objects_static.used, file_name.string, sizeof(f_char_t) * file_name.used); + memcpy(source_string + data->path_build_objects_static.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); } *status = fll_execute_arguments_add(source, &arguments); @@ -590,6 +599,204 @@ extern "C" { } #endif // _di_fake_build_library_static_ +#ifndef _di_fake_build_library_static_object_ + int fake_build_library_static_object(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { + + if (*status == F_child) return data->main->child; + if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; + if (!data_build->setting.build_sources_library.used && !data_build->setting.build_sources_library_static.used) return 0; + + if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { + fll_print_format("%r%[Compiling static library objects.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); + } + + f_string_dynamics_t arguments = f_string_dynamics_t_initialize; + f_string_dynamic_t file_name = f_string_dynamic_t_initialize; + f_string_dynamic_t destination_path = f_string_dynamic_t_initialize; + f_string_static_t destination = f_string_static_t_initialize; + f_string_static_t source = f_string_static_t_initialize; + + int result = data->main->child; + + const f_string_dynamics_t *sources[2] = { + &data_build->setting.build_sources_library, + &data_build->setting.build_sources_library_static, + }; + + f_array_length_t i = 0; + f_array_length_t j = 0; + uint8_t k = 0; + + for (i = 0; i < 2; ++i) { + + for (j = 0; j < sources[i]->used; ++j) { + + if (!sources[i]->array[j].used) continue; + + file_name.used = 0; + destination_path.used = 0; + arguments.used = 0 ; + + fake_build_path_source_length(data, data_build, &data_build->setting.path_sources_library, &source); + + f_char_t source_string[source.used + sources[i]->array[j].used + 1]; + source.string = source_string; + + fake_build_path_source_string(data, data_build, &data_build->setting.path_sources_library, &source); + + memcpy(source_string + source.used, sources[i]->array[j].string, sizeof(f_char_t) * 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(data, sources[i]->array[j], &file_name); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + + break; + } + + *status = f_file_name_directory(sources[i]->array[j], &destination_path); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); + + break; + } + + if (destination_path.used) { + *status = f_string_dynamic_prepend(data->path_build_objects_static, &destination_path); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); + + break; + } + + *status = f_string_dynamic_append_assure(f_path_separator_s, &destination_path); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true); + + break; + } + + *status = f_directory_exists(destination_path); + + if (*status == F_false) { + if (data->main->error.verbosity != f_console_verbosity_quiet_e) { + flockfile(data->main->error.to.stream); + + fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); + fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, destination_path, data->main->error.notable); + fl_print_format("%[' exists but is not a directory.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s); + + funlockfile(data->main->error.to.stream); + } + + *status = F_status_set_error(F_failure); + + break; + } + + if (*status == F_file_found_not) { + *status = f_directory_create(destination_path, mode.directory); + + if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_file_found_not) { + flockfile(data->main->error.to.stream); + + fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); + fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, destination_path, data->main->error.notable); + fl_print_format("%[' could not be created, a parent directory does not exist.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s); + + funlockfile(data->main->error.to.stream); + } + else { + fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_create", F_true, destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); + } + + break; + } + + if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { + fll_print_format("Directory '%Q' created.%r", data->main->output.to.stream, destination_path, f_string_eol_s); + } + } + + if (F_status_is_error(*status)) { + fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); + + break; + } + + destination.used = destination_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; + } + else { + destination.used = data->path_build_objects_static.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; + } + + f_char_t destination_string[destination.used + 1]; + destination.string = destination_string; + destination_string[destination.used] = 0; + + if (destination_path.used) { + memcpy(destination_string, destination_path.string, sizeof(f_char_t) * destination_path.used); + memcpy(destination_string + destination_path.used, file_name.string, sizeof(f_char_t) * file_name.used); + memcpy(destination_string + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); + } + else { + memcpy(destination_string, data->path_build_objects_static.string, sizeof(f_char_t) * data->path_build_objects_static.used); + memcpy(destination_string + data->path_build_objects_static.used, file_name.string, sizeof(f_char_t) * file_name.used); + memcpy(destination_string + data->path_build_objects_static.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); + } + + const f_string_static_t values[] = { + source, + fake_build_parameter_object_compile_s, + fake_build_parameter_object_static_s, + fake_build_parameter_object_output_s, + destination, + }; + + for (k = 0; k < 5; ++k) { + + if (!values[k].used) continue; + + *status = fll_execute_arguments_add(values[k], &arguments); + if (F_status_is_error(*status)) break; + } // for + + fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_object_e, &arguments, status); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + + break; + } + + result = fake_execute(data, data_build->environment, data_build->setting.build_compiler, arguments, status); + + macro_f_string_dynamics_t_delete_simple(arguments); + + if (F_status_is_error(*status) || *status == F_child) break; + } // for + + if (F_status_is_error(*status) || *status == F_child) break; + } // for + + f_string_dynamic_resize(0, &file_name); + f_string_dynamic_resize(0, &destination_path); + f_string_dynamics_resize(0, &arguments); + + if (F_status_is_error_not(*status) && *status != F_child) { + fake_build_touch(data, file_stage, status); + } + + return result; + } +#endif // _di_fake_build_library_static_object_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/private-build-library.h b/level_3/fake/c/private-build-library.h index 41b80c3..de0875e 100644 --- a/level_3/fake/c/private-build-library.h +++ b/level_3/fake/c/private-build-library.h @@ -89,6 +89,30 @@ extern "C" { extern int fake_build_library_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) F_attribute_visibility_internal_d; #endif // _di_fake_build_library_static_ +/** + * Build the static libraries object. + * + * @param data + * The program data. + * @param data_build + * The build data. + * @param mode + * The file mode. + * @param file_stage + * The specific stage file path. + * @param status + * F_none on success. + * + * Status codes (with error bit) are returned on any problem. + * + * @return + * The return code of the execution process. + * This generally is only needed when F_child is returned, where this holds the return status of the child process. + */ +#ifndef _di_fake_build_library_static_object_ + extern int fake_build_library_static_object(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) F_attribute_visibility_internal_d; +#endif // _di_fake_build_library_static_object_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/level_3/fake/c/private-build-load.c b/level_3/fake/c/private-build-load.c index 11313f0..ea478b2 100644 --- a/level_3/fake/c/private-build-load.c +++ b/level_3/fake/c/private-build-load.c @@ -268,9 +268,6 @@ extern "C" { f_string_dynamics_t build_name = f_string_dynamics_t_initialize; f_string_dynamics_t build_script = f_string_dynamics_t_initialize; f_string_dynamics_t build_shared = f_string_dynamics_t_initialize; - f_string_dynamics_t build_sources_object = f_string_dynamics_t_initialize; - f_string_dynamics_t build_sources_object_shared = f_string_dynamics_t_initialize; - f_string_dynamics_t build_sources_object_static = f_string_dynamics_t_initialize; f_string_dynamics_t build_static = f_string_dynamics_t_initialize; f_string_dynamics_t has_path_standard = f_string_dynamics_t_initialize; f_string_dynamics_t path_headers = f_string_dynamics_t_initialize; @@ -285,7 +282,11 @@ extern "C" { f_string_dynamics_t path_program_shared = f_string_dynamics_t_initialize; f_string_dynamics_t path_program_static = f_string_dynamics_t_initialize; f_string_dynamics_t path_sources = f_string_dynamics_t_initialize; + f_string_dynamics_t path_sources_headers = f_string_dynamics_t_initialize; + f_string_dynamics_t path_sources_library = f_string_dynamics_t_initialize; f_string_dynamics_t path_sources_object = f_string_dynamics_t_initialize; + f_string_dynamics_t path_sources_program = f_string_dynamics_t_initialize; + f_string_dynamics_t path_sources_script = f_string_dynamics_t_initialize; f_string_dynamics_t preserve_path_headers = f_string_dynamics_t_initialize; f_string_dynamics_t process_post = f_string_dynamics_t_initialize; f_string_dynamics_t process_pre = f_string_dynamics_t_initialize; @@ -376,7 +377,11 @@ extern "C" { fake_build_setting_name_path_program_shared_s, fake_build_setting_name_path_program_static_s, fake_build_setting_name_path_sources_s, + fake_build_setting_name_path_sources_headers_s, + fake_build_setting_name_path_sources_library_s, fake_build_setting_name_path_sources_object_s, + fake_build_setting_name_path_sources_program_s, + fake_build_setting_name_path_sources_script_s, fake_build_setting_name_preserve_path_headers_s, fake_build_setting_name_process_post_s, fake_build_setting_name_process_pre_s, @@ -419,9 +424,9 @@ extern "C" { &setting->build_sources_library, &setting->build_sources_library_shared, &setting->build_sources_library_static, - &build_sources_object, - &build_sources_object_shared, - &build_sources_object_static, + &setting->build_sources_object, + &setting->build_sources_object_shared, + &setting->build_sources_object_static, &setting->build_sources_program, &setting->build_sources_program_shared, &setting->build_sources_program_static, @@ -468,7 +473,11 @@ extern "C" { &path_program_shared, &path_program_static, &path_sources, + &path_sources_headers, + &path_sources_library, &path_sources_object, + &path_sources_program, + &path_sources_script, &preserve_path_headers, &process_post, &process_pre, @@ -497,26 +506,26 @@ extern "C" { F_false, // setting->build_libraries_static F_false, // build_name F_false, // setting->build_objects_library - F_false, // setting->build_objects_library_shar - F_false, // setting->build_objects_library_stat + F_false, // setting->build_objects_library_shared + F_false, // setting->build_objects_library_static F_false, // setting->build_objects_program - F_false, // setting->build_objects_program_shar - F_false, // setting->build_objects_program_stat + F_false, // setting->build_objects_program_shared + F_false, // setting->build_objects_program_static F_false, // build_script F_false, // build_shared F_false, // setting->build_sources_documentation F_false, // setting->build_sources_headers - F_false, // setting->build_sources_headers_shar - F_false, // setting->build_sources_headers_stat + F_false, // setting->build_sources_headers_shared + F_false, // setting->build_sources_headers_static F_false, // setting->build_sources_library - F_false, // setting->build_sources_library_shar - F_false, // setting->build_sources_library_stat - F_false, // build_sources_object - F_false, // build_sources_object_shared - F_false, // build_sources_object_static + F_false, // setting->build_sources_library_shared + F_false, // setting->build_sources_library_static + F_false, // setting->build_sources_object + F_false, // setting->build_sources_object_shared + F_false, // setting->build_sources_object_static F_false, // setting->build_sources_program - F_false, // setting->build_sources_program_shar - F_false, // setting->build_sources_program_stat + F_false, // setting->build_sources_program_shared + F_false, // setting->build_sources_program_static F_false, // setting->build_sources_script F_false, // setting->build_sources_setting F_false, // build_static @@ -560,7 +569,11 @@ extern "C" { F_false, // path_program_shared F_false, // path_program_static F_false, // path_sources + F_false, // path_sources_headers + F_false, // path_sources_library F_false, // path_sources_object + F_false, // path_sources_program + F_false, // path_sources_script F_false, // preserve_path_headers F_false, // process_post F_false, // process_pre @@ -733,9 +746,6 @@ extern "C" { fake_build_setting_name_build_name_s, fake_build_setting_name_build_script_s, fake_build_setting_name_build_shared_s, - fake_build_setting_name_build_sources_object_s, - fake_build_setting_name_build_sources_object_shared_s, - fake_build_setting_name_build_sources_object_static_s, fake_build_setting_name_build_static_s, fake_build_setting_name_has_path_standard_s, fake_build_setting_name_path_headers_s, @@ -750,7 +760,11 @@ extern "C" { fake_build_setting_name_path_program_shared_s, fake_build_setting_name_path_program_static_s, fake_build_setting_name_path_sources_s, + fake_build_setting_name_path_sources_headers_s, + fake_build_setting_name_path_sources_library_s, fake_build_setting_name_path_sources_object_s, + fake_build_setting_name_path_sources_program_s, + fake_build_setting_name_path_sources_script_s, fake_build_setting_name_preserve_path_headers_s, fake_build_setting_name_process_post_s, fake_build_setting_name_process_pre_s, @@ -776,9 +790,6 @@ extern "C" { &build_name, &build_script, &build_shared, - &build_sources_object, - &build_sources_object_shared, - &build_sources_object_static, &build_static, &has_path_standard, &path_headers, @@ -793,7 +804,11 @@ extern "C" { &path_program_shared, &path_program_static, &path_sources, + &path_sources_headers, + &path_sources_library, &path_sources_object, + &path_sources_program, + &path_sources_script, &preserve_path_headers, &process_post, &process_pre, @@ -819,9 +834,6 @@ extern "C" { 0, // build_name &setting->build_script, // build_script &setting->build_shared, // build_shared - 0, // build_sources_object - 0, // build_sources_object_shared - 0, // build_sources_object_static &setting->build_static, // build_static &setting->has_path_standard, // has_path_standard 0, // path_headers @@ -836,7 +848,11 @@ extern "C" { 0, // path_program_shared 0, // path_program_static 0, // path_sources + 0, // path_sources_headers + 0, // path_sources_library 0, // path_sources_object + 0, // path_sources_program + 0, // path_sources_script &setting->preserve_path_headers, // preserve_path_headers 0, // process_post 0, // process_pre @@ -852,9 +868,6 @@ extern "C" { &setting->build_name, // build_name 0, // build_script 0, // build_shared - &setting->build_sources_object, // build_sources_object - &setting->build_sources_object_shared, // build_sources_object_shared - &setting->build_sources_object_static, // build_sources_object_static 0, // build_static 0, // has_path_standard &setting->path_headers, // path_headers @@ -869,7 +882,11 @@ extern "C" { &setting->path_program_shared, // path_program_shared &setting->path_program_static, // path_program_static &setting->path_sources, // path_sources + &setting->path_sources_headers, // path_sources_headers + &setting->path_sources_library, // path_sources_library &setting->path_sources_object, // path_sources_object + &setting->path_sources_program, // path_sources_program + &setting->path_sources_script, // path_sources_script 0, // preserve_path_headers &setting->process_post, // process_post &setting->process_pre, // process_pre @@ -895,9 +912,6 @@ extern "C" { settings_matches[7], // build_name settings_matches[14], // build_script settings_matches[15], // build_shared - settings_matches[23], // build_sources_object - settings_matches[24], // build_sources_object_shared - settings_matches[25], // build_sources_object_static settings_matches[31], // build_static settings_matches[57], // has_path_standard settings_matches[60], // path_headers @@ -912,23 +926,27 @@ extern "C" { settings_matches[69], // path_program_shared settings_matches[70], // path_program_static settings_matches[71], // path_sources - settings_matches[72], // path_sources_object - settings_matches[73], // preserve_path_headers - settings_matches[74], // process_post - settings_matches[75], // process_pre - settings_matches[76], // search_exclusive - settings_matches[77], // search_shared - settings_matches[78], // search_static - settings_matches[79], // version_file - settings_matches[80], // version_major - settings_matches[81], // version_major_prefix - settings_matches[82], // version_micro - settings_matches[83], // version_micro_prefix - settings_matches[84], // version_minor - settings_matches[85], // version_minor_prefix - settings_matches[86], // version_nano - settings_matches[87], // version_nano_prefix - settings_matches[88], // version_target + settings_matches[72], // path_sources_headers + settings_matches[73], // path_sources_library + settings_matches[74], // path_sources_object + settings_matches[75], // path_sources_program + settings_matches[76], // path_sources_script + settings_matches[77], // preserve_path_headers + settings_matches[78], // process_post + settings_matches[79], // process_pre + settings_matches[80], // search_exclusive + settings_matches[81], // search_shared + settings_matches[82], // search_static + settings_matches[83], // version_file + settings_matches[84], // version_major + settings_matches[85], // version_major_prefix + settings_matches[86], // version_micro + settings_matches[87], // version_micro_prefix + settings_matches[88], // version_minor + settings_matches[80], // version_minor_prefix + settings_matches[90], // version_nano + settings_matches[91], // version_nano_prefix + settings_matches[92], // version_target }; const f_string_static_t settings_single_string_default[] = { @@ -938,9 +956,6 @@ extern "C" { f_string_empty_s, // build_name f_string_empty_s, // build_script f_string_empty_s, // build_shared - f_string_empty_s, // build_sources_object - f_string_empty_s, // build_sources_object_shared - f_string_empty_s, // build_sources_object_static f_string_empty_s, // build_static fake_build_setting_default_yes_s, // has_path_standard f_string_empty_s, // path_headers @@ -955,7 +970,11 @@ extern "C" { fake_path_part_shared_s, // path_program_shared fake_path_part_static_s, // path_program_static data->path_sources, // path_sources + f_string_empty_s, // path_sources_headers + f_string_empty_s, // path_sources_library f_string_empty_s, // path_sources_object + f_string_empty_s, // path_sources_program + f_string_empty_s, // path_sources_script f_string_empty_s, // preserve_path_headers f_string_empty_s, // process_post f_string_empty_s, // process_pre @@ -987,9 +1006,6 @@ extern "C" { 0, // build_name 0, // build_script 0, // build_shared - 0, // build_sources_object - 0, // build_sources_object_shared - 0, // build_sources_object_static 0, // build_static 0, // has_path_standard 0, // path_headers @@ -1004,7 +1020,11 @@ extern "C" { 0, // path_program_shared 0, // path_program_static 0, // path_sources + 0, // path_sources_headers + 0, // path_sources_library 0, // path_sources_object + 0, // path_sources_program + 0, // path_sources_script 0, // preserve_path_headers 0, // process_post 0, // process_pre @@ -1030,9 +1050,6 @@ extern "C" { 0, // build_name 0, // build_script 0, // build_shared - 0, // build_sources_object - 0, // build_sources_object_shared - 0, // build_sources_object_static 0, // build_static 0, // has_path_standard 0, // path_headers @@ -1047,7 +1064,11 @@ extern "C" { 0, // path_program_shared 0, // path_program_static 0, // path_sources + 0, // path_sources_headers + 0, // path_sources_library 0, // path_sources_object + 0, // path_sources_program + 0, // path_sources_script 0, // preserve_path_headers 0, // process_post 0, // process_pre @@ -1073,9 +1094,6 @@ extern "C" { f_string_empty_s, // build_name f_string_empty_s, // build_script f_string_empty_s, // build_shared - f_string_empty_s, // build_sources_object - f_string_empty_s, // build_sources_object_shared - f_string_empty_s, // build_sources_object_static f_string_empty_s, // build_static f_string_empty_s, // has_path_standard f_string_empty_s, // path_headers @@ -1090,7 +1108,11 @@ extern "C" { f_string_empty_s, // path_program_shared f_string_empty_s, // path_program_static f_string_empty_s, // path_sources + f_string_empty_s, // path_sources_headers + f_string_empty_s, // path_sources_library f_string_empty_s, // path_sources_object + f_string_empty_s, // path_sources_program + f_string_empty_s, // path_sources_script f_string_empty_s, // preserve_path_headers f_string_empty_s, // process_post f_string_empty_s, // process_pre @@ -1117,9 +1139,6 @@ extern "C" { 3, // build_name 1, // build_script 1, // build_shared - 3, // build_sources_object - 3, // build_sources_object_shared - 3, // build_sources_object_static 1, // build_static 1, // has_path_standard 2, // path_headers @@ -1134,7 +1153,11 @@ extern "C" { 2, // path_program_shared 2, // path_program_static 2, // path_sources + 2, // path_sources_headers + 2, // path_sources_library 2, // path_sources_object + 2, // path_sources_program + 2, // path_sources_script 1, // preserve_path_headers 3, // process_post 3, // process_pre @@ -1153,7 +1176,7 @@ extern "C" { 5, // version_target }; - for (f_array_length_t i = 0; i < 40; ++i) { + for (f_array_length_t i = 0; i < 41; ++i) { // Assign the default for literal and path types. if (!settings_single_matches[i] && settings_single_destination[i]) { @@ -1343,6 +1366,87 @@ extern "C" { } } } + + // Handle special defaults for path sources. + if (F_status_is_error_not(*status)) { + + // [72] path_sources_headers. + if (!settings_matches[72]) { + setting->path_sources_headers.used = 0; + + *status = f_string_dynamic_append_nulless(setting->path_sources, &setting->path_sources_headers); + } + + // [73] path_sources_library. + if (!settings_matches[73] && F_status_is_error_not(*status)) { + setting->path_sources_library.used = 0; + + *status = f_string_dynamic_append_nulless(setting->path_sources, &setting->path_sources_library); + } + + // [74] path_sources_object. + if (!settings_matches[74] && F_status_is_error_not(*status)) { + setting->path_sources_object.used = 0; + + *status = f_string_dynamic_append_nulless(setting->path_sources, &setting->path_sources_object); + } + + // [75] path_sources_program. + if (!settings_matches[75] && F_status_is_error_not(*status)) { + setting->path_sources_program.used = 0; + + *status = f_string_dynamic_append_nulless(setting->path_sources, &setting->path_sources_program); + } + + // [76] path_sources_script. + if (!settings_matches[76] && F_status_is_error_not(*status)) { + setting->path_sources_script.used = 0; + + *status = f_string_dynamic_append_nulless(setting->path_sources, &setting->path_sources_script); + } + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); + } + } + + if (F_status_is_error_not(*status)) { + if (checks && !setting->version_file) { + setting->version_file = fake_build_version_type_micro_e; + + if (data->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data->main->warning.to.stream); + + fl_print_format("%[%QThe setting '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.prefix, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, fake_build_setting_name_version_file_s, data->main->warning.notable); + fl_print_format("%[' in the file '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, path_file, data->main->warning.notable); + fl_print_format("%[' is required, defaulting to '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, fake_build_version_micro_s, data->main->warning.notable); + fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s); + + funlockfile(data->main->warning.to.stream); + } + } + + if (checks && !setting->version_target) { + setting->version_target = fake_build_version_type_major_e; + + if (data->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data->main->warning.to.stream); + + fl_print_format("%[%QThe setting '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.prefix, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, fake_build_setting_name_version_target_s, data->main->warning.notable); + fl_print_format("%[' in the file '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, path_file, data->main->warning.notable); + fl_print_format("%[' is required, defaulting to '%]", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context); + fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, fake_build_version_major_s, data->main->warning.notable); + fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s); + + funlockfile(data->main->warning.to.stream); + } + } + } } f_string_dynamics_resize(0, &build_compiler); @@ -1351,9 +1455,6 @@ extern "C" { f_string_dynamics_resize(0, &build_name); f_string_dynamics_resize(0, &build_script); f_string_dynamics_resize(0, &build_shared); - f_string_dynamics_resize(0, &build_sources_object); - f_string_dynamics_resize(0, &build_sources_object_shared); - f_string_dynamics_resize(0, &build_sources_object_static); f_string_dynamics_resize(0, &build_static); f_string_dynamics_resize(0, &has_path_standard); f_string_dynamics_resize(0, &path_headers); @@ -1368,7 +1469,11 @@ extern "C" { f_string_dynamics_resize(0, &path_program_shared); f_string_dynamics_resize(0, &path_program_static); f_string_dynamics_resize(0, &path_sources); + f_string_dynamics_resize(0, &path_sources_headers); + f_string_dynamics_resize(0, &path_sources_library); f_string_dynamics_resize(0, &path_sources_object); + f_string_dynamics_resize(0, &path_sources_program); + f_string_dynamics_resize(0, &path_sources_script); f_string_dynamics_resize(0, &preserve_path_headers); f_string_dynamics_resize(0, &process_post); f_string_dynamics_resize(0, &process_pre); @@ -1385,6 +1490,10 @@ extern "C" { f_string_dynamics_resize(0, &version_nano); f_string_dynamics_resize(0, &version_nano_prefix); f_string_dynamics_resize(0, &version_target); + + if (F_status_is_error_not(*status)) { + *status = F_none; + } } #endif // _di_fake_build_load_setting_process_ @@ -1514,6 +1623,7 @@ extern "C" { fake_build_stage_library_script_s, fake_build_stage_library_shared_s, fake_build_stage_library_static_s, + fake_build_stage_library_static_object_s, fake_build_stage_object_script_s, fake_build_stage_object_shared_s, fake_build_stage_object_static_s, @@ -1534,6 +1644,7 @@ extern "C" { &stage->file_library_script, &stage->file_library_shared, &stage->file_library_static, + &stage->file_library_static_object, &stage->file_object_script, &stage->file_object_shared, &stage->file_object_static, diff --git a/level_3/fake/c/private-build-object.c b/level_3/fake/c/private-build-object.c index 1ac55a0..7b6a807 100644 --- a/level_3/fake/c/private-build-object.c +++ b/level_3/fake/c/private-build-object.c @@ -20,149 +20,200 @@ extern "C" { } #endif // _di_fake_build_object_script_ -#ifndef _di_fake_build_object_shared_ - int fake_build_object_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { +#ifndef _di_fake_build_object_ + int fake_build_object(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, const uint8_t shared, f_status_t * const status) { if (*status == F_child) return data->main->child; if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; - if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_shared.used) return 0; + if (!data_build->setting.build_sources_object.used && (shared && !data_build->setting.build_sources_object_shared.used || !shared && !data_build->setting.build_sources_object_static.used)) return 0; if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { - fll_print_format("%r%[Compiling shared object.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); + if (shared) { + fll_print_format("%r%[Compiling shared object.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); + } + else { + fll_print_format("%r%[Compiling static object.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); + } } + int result = 0; + int result_final = 0; + + f_number_unsigned_t i = 0; + f_number_unsigned_t j = 0; + + const f_string_dynamics_t *sources[2] = { + &data_build->setting.build_sources_object, + shared ? &data_build->setting.build_sources_object_shared : &data_build->setting.build_sources_object_static, + }; + f_string_dynamics_t arguments = f_string_dynamics_t_initialize; + f_string_dynamic_t cache_1 = f_string_dynamic_t_initialize; + f_string_dynamic_t cache_2 = f_string_dynamic_t_initialize; + f_string_dynamic_t cache_3 = f_string_dynamic_t_initialize; - *status = fake_build_sources_object_add(data, data_build, &data_build->setting.build_sources_object, &data_build->setting.build_sources_object_shared, &arguments); + for (i = 0; i < 2; ++i) { - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_object_add", F_true); + for (j = 0; j < sources[i]->used && F_status_is_error_not(*status); ++j) { - f_string_dynamics_resize(0, &arguments); + while (arguments.used) { + arguments.array[--arguments.used].used = 0; + } // while - return 0; - } + *status = fake_build_sources_object_add(data, data_build, &sources[i]->array[j], &arguments); - { - f_string_static_t parameter_file_name_path = f_string_static_t_initialize; - parameter_file_name_path.used = data->path_build_objects_shared.used + data_build->setting.build_name.used + fake_build_parameter_object_name_suffix_s.used; + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_object_add", F_true); - f_char_t parameter_file_name_path_string[parameter_file_name_path.used + 1]; - parameter_file_name_path.string = parameter_file_name_path_string; - parameter_file_name_path_string[parameter_file_name_path.used] = 0; + break; + } - memcpy(parameter_file_name_path_string, data->path_build_objects_shared.string, sizeof(f_char_t) * data->path_build_objects_shared.used); - memcpy(parameter_file_name_path_string + data->path_build_objects_shared.used, data_build->setting.build_name.string, sizeof(f_char_t) * data_build->setting.build_name.used); - memcpy(parameter_file_name_path_string + data->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); + cache_1.used = 0; + cache_2.used = 0; + cache_3.used = 0; - const f_string_static_t values[] = { - fake_build_parameter_object_compile_s, - fake_build_parameter_object_output_s, - parameter_file_name_path, - }; + fake_build_get_file_name_without_extension(data, sources[i]->array[j], &cache_1); - for (uint8_t i = 0; i < 3; ++i) { + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); - if (!values[i].used) continue; + break; + } - *status = fll_execute_arguments_add(values[i], &arguments); - if (F_status_is_error(*status)) break; - } // for - } + *status = f_file_name_directory(sources[i]->array[j], &cache_2); - fake_build_arguments_standard_add(data, data_build, F_true, fake_build_type_object_e, &arguments, status); + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_arguments_standard_add", F_true); + break; + } - macro_f_string_dynamics_t_delete_simple(arguments); + *status = f_string_dynamic_append_assure(f_path_separator_s, &cache_2); - return 0; - } + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true); - int result = fake_execute(data, data_build->environment, data_build->setting.build_compiler, arguments, status); + break; + } - macro_f_string_dynamics_t_delete_simple(arguments); + *status = f_string_dynamic_append_nulless(shared ? data->path_build_objects_shared : data->path_build_objects_static, &cache_3); - if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); - } + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(cache_2, &cache_3); + } - return result; - } -#endif // _di_fake_build_object_shared_ + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); -#ifndef _di_fake_build_object_static_ - int fake_build_object_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { + break; + } - if (*status == F_child) return data->main->child; - if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; - if (!data_build->setting.build_sources_object.used && !data_build->setting.build_sources_object_static.used) return 0; + *status = f_directory_exists(cache_3); - if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { - fll_print_format("%r%[Compiling static object.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); - } + if (*status == F_false) { + fll_error_file_print(data->main->error, F_file_type_not_directory, "f_directory_exists", F_true, cache_3, f_file_operation_find_s, fll_error_file_type_directory_e); - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; + *status = F_status_set_error(F_failure); - *status = fake_build_sources_object_add(data, data_build, &data_build->setting.build_sources_object, &data_build->setting.build_sources_object_static, &arguments); + break; + } - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_object_add", F_true); + if (*status == F_file_found_not) { + *status = f_directory_create(cache_3, mode.directory); - f_string_dynamics_resize(0, &arguments); + if (F_status_is_error(*status)) { + if (F_status_set_fine(*status) == F_file_found_not) { + flockfile(data->main->error.to.stream); - return 0; - } + fl_print_format("%[%QThe path '%]", data->main->error.to.stream, data->main->error.context, data->main->error.prefix, data->main->error.context); + fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, cache_3, data->main->error.notable); + fl_print_format("%[' could not be created, a parent directory is invalid or does not exist.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s); - { - f_string_static_t parameter_file_name_path = f_string_static_t_initialize; - parameter_file_name_path.used = data->path_build_objects_static.used + data_build->setting.build_name.used + fake_build_parameter_object_name_suffix_s.used; + funlockfile(data->main->error.to.stream); + } + else { + fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_create", F_true, cache_3, f_file_operation_create_s, fll_error_file_type_directory_e); + } - f_char_t parameter_file_name_path_string[parameter_file_name_path.used + 1]; - parameter_file_name_path.string = parameter_file_name_path_string; - parameter_file_name_path_string[parameter_file_name_path.used] = 0; + break; + } + } + else if (F_status_is_error(*status)) { + fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_exists", F_true, cache_3, f_file_operation_create_s, fll_error_file_type_directory_e); - memcpy(parameter_file_name_path_string, data->path_build_objects_static.string, sizeof(f_char_t) * data->path_build_objects_static.used); - memcpy(parameter_file_name_path_string + data->path_build_objects_static.used, data_build->setting.build_name.string, sizeof(f_char_t) * data_build->setting.build_name.used); - memcpy(parameter_file_name_path_string + data->path_build_objects_static.used + data_build->setting.build_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); + break; + } - const f_string_static_t values[] = { - fake_build_parameter_object_compile_s, - fake_build_parameter_object_output_s, - parameter_file_name_path, - }; + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(cache_1, &cache_3); + } - for (uint8_t i = 0; i < 3; ++i) { + if (F_status_is_error_not(*status)) { + *status = f_string_dynamic_append_nulless(fake_build_parameter_object_name_suffix_s, &cache_3); + } - if (!values[i].used) continue; + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_nulless", F_true); - *status = fll_execute_arguments_add(values[i], &arguments); - if (F_status_is_error(*status)) break; - } // for - } + break; + } - fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_object_e, &arguments, status); + { + const f_string_static_t values[] = { + shared ? f_string_empty_s : fake_build_parameter_library_static_s, + fake_build_parameter_object_compile_s, + fake_build_parameter_object_output_s, + cache_3, + }; - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_arguments_standard_add", F_true); + for (uint8_t i = 0; i < 4; ++i) { - macro_f_string_dynamics_t_delete_simple(arguments); + if (!values[i].used) continue; - return 0; - } + *status = fll_execute_arguments_add(values[i], &arguments); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + + break; + } + } // for + } - int result = fake_execute(data, data_build->environment, data_build->setting.build_compiler, arguments, status); + fake_build_arguments_standard_add(data, data_build, F_true, fake_build_type_object_e, &arguments, status); // @todo don't add linkage for object. + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_arguments_standard_add", F_true); + + break; + } + + result = fake_execute(data, data_build->environment, data_build->setting.build_compiler, arguments, status); + + if (F_status_is_error(*status)) { + fll_error_print(data->main->error, F_status_set_fine(*status), "fake_execute", F_true); + + break; + } + + if (result && !result_final) { + result_final = result; + } + } // for + } // for + macro_f_string_dynamic_t_delete_simple(cache_1); + macro_f_string_dynamic_t_delete_simple(cache_2); + macro_f_string_dynamic_t_delete_simple(cache_3); macro_f_string_dynamics_t_delete_simple(arguments); if (F_status_is_error_not(*status) && *status != F_child) { fake_build_touch(data, file_stage, status); } - return result; + return result_final; } -#endif // _di_fake_build_object_static_ +#endif // _di_fake_build_object_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/private-build-object.h b/level_3/fake/c/private-build-object.h index 11a0ff0..004a954 100644 --- a/level_3/fake/c/private-build-object.h +++ b/level_3/fake/c/private-build-object.h @@ -55,6 +55,9 @@ extern "C" { * The file mode. * @param file_stage * The specific stage file path. + * @param shared + * If F_true, then build a shared object. + * Otherwise, build a static object. * @param status * F_none on success. * @@ -64,36 +67,9 @@ extern "C" { * The return code of the execution process. * This generally is only needed when F_child is returned, where this holds the return status of the child process. */ -#ifndef _di_fake_build_object_shared_ - extern int fake_build_object_shared(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) F_attribute_visibility_internal_d; -#endif // _di_fake_build_object_shared_ - -/** - * Build the static objects. - * - * Object files can be compiled differently between shared and static such that a shared object might be compiled with -fPIC and a static object might not be. - * This represents an object being compiled with the intent to be used in a static library or program. - * - * @param data - * The program data. - * @param data_build - * The build data. - * @param mode - * The file mode. - * @param file_stage - * The specific stage file path. - * @param status - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @return - * The return code of the execution process. - * This generally is only needed when F_child is returned, where this holds the return status of the child process. - */ -#ifndef _di_fake_build_object_static_ - extern int fake_build_object_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) F_attribute_visibility_internal_d; -#endif // _di_fake_build_object_static_ +#ifndef _di_fake_build_object_ + extern int fake_build_object(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, const uint8_t shared, f_status_t * const status) F_attribute_visibility_internal_d; +#endif // _di_fake_build_object_ #ifdef __cplusplus } // extern "C" diff --git a/level_3/fake/c/private-build-objects.c b/level_3/fake/c/private-build-objects.c deleted file mode 100644 index db50092..0000000 --- a/level_3/fake/c/private-build-objects.c +++ /dev/null @@ -1,220 +0,0 @@ -#include "fake.h" -#include "private-common.h" -#include "private-fake.h" -#include "private-build.h" -#include "private-build-objects.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _di_fake_build_objects_static_ - int fake_build_objects_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) { - - if (*status == F_child) return data->main->child; - if (F_status_is_error(*status) || f_file_exists(file_stage, F_true) == F_true) return 0; - if (!data_build->setting.build_sources_library.used) return 0; - - if (data->main->output.verbosity != f_console_verbosity_quiet_e && data->main->output.verbosity != f_console_verbosity_error_e) { - fll_print_format("%r%[Compiling objects for static library.%]%r", data->main->output.to.stream, f_string_eol_s, data->main->context.set.important, data->main->context.set.important, f_string_eol_s); - } - - f_string_dynamics_t arguments = f_string_dynamics_t_initialize; - - *status = fake_build_objects_add(data, data_build, &data->path_build_objects_static, &data_build->setting.build_objects_library, &data_build->setting.build_objects_library_static, &arguments); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_objects_add", F_true); - - f_string_dynamics_resize(0, &arguments); - - return 0; - } - - f_string_dynamic_t file_name = f_string_dynamic_t_initialize; - f_string_dynamic_t destination_path = f_string_dynamic_t_initialize; - f_string_static_t destination = f_string_static_t_initialize; - f_string_static_t source = f_string_static_t_initialize; - - int result = data->main->child; - - const f_string_dynamics_t *sources[2] = { - &data_build->setting.build_sources_library, - &data_build->setting.build_sources_library_static, - }; - - f_array_length_t i = 0; - f_array_length_t j = 0; - - for (i = 0; i < 2; ++i) { - - for (j = 0; j < sources[i]->used; ++j) { - - if (!sources[i]->array[j].used) continue; - - file_name.used = 0; - destination_path.used = 0; - - fake_build_path_source_length(data, data_build, &data_build->setting.path_sources, &source); - - f_char_t source_string[source.used + sources[i]->array[j].used + 1]; - source.string = source_string; - - fake_build_path_source_string(data, data_build, &data_build->setting.path_sources, &source); - - memcpy(source_string + source.used, sources[i]->array[j].string, sizeof(f_char_t) * 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(data, sources[i]->array[j], &file_name); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); - - break; - } - - *status = f_file_name_directory(sources[i]->array[j], &destination_path); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "f_file_name_directory", F_true); - - break; - } - - if (destination_path.used) { - *status = f_string_dynamic_prepend(data->path_build_objects, &destination_path); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_prepend", F_true); - - break; - } - - *status = f_string_dynamic_append_assure(f_path_separator_s, &destination_path); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "f_string_dynamic_append_assure", F_true); - - break; - } - - *status = f_directory_exists(destination_path); - - if (*status == F_false) { - if (data->main->error.verbosity != f_console_verbosity_quiet_e) { - flockfile(data->main->error.to.stream); - - fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, destination_path, data->main->error.notable); - fl_print_format("%[' exists but is not a directory.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s); - - funlockfile(data->main->error.to.stream); - } - - *status = F_status_set_error(F_failure); - - break; - } - - if (*status == F_file_found_not) { - *status = f_directory_create(destination_path, mode.directory); - - if (F_status_is_error(*status)) { - if (F_status_set_fine(*status) == F_file_found_not) { - flockfile(data->main->error.to.stream); - - fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context); - fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, destination_path, data->main->error.notable); - fl_print_format("%[' could not be created, a parent directory does not exist.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s); - - funlockfile(data->main->error.to.stream); - } - else { - fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_create", F_true, destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); - } - - break; - } - - if (data->main->error.verbosity >= f_console_verbosity_verbose_e) { - fll_print_format("Directory '%Q' created.%r", data->main->output.to.stream, destination_path, f_string_eol_s); - } - } - - if (F_status_is_error(*status)) { - fll_error_file_print(data->main->error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path, f_file_operation_create_s, fll_error_file_type_directory_e); - - break; - } - - destination.used = destination_path.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; - } - else { - destination.used = data->path_build_objects.used + file_name.used + fake_build_parameter_object_name_suffix_s.used; - } - - f_char_t destination_string[destination.used + 1]; - destination.string = destination_string; - destination_string[destination.used] = 0; - - if (destination_path.used) { - memcpy(destination_string, destination_path.string, sizeof(f_char_t) * destination_path.used); - memcpy(destination_string + destination_path.used, file_name.string, sizeof(f_char_t) * file_name.used); - memcpy(destination_string + destination_path.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); - } - else { - memcpy(destination_string, data->path_build_objects.string, sizeof(f_char_t) * data->path_build_objects.used); - memcpy(destination_string + data->path_build_objects.used, file_name.string, sizeof(f_char_t) * file_name.used); - memcpy(destination_string + data->path_build_objects.used + file_name.used, fake_build_parameter_object_name_suffix_s.string, sizeof(f_char_t) * fake_build_parameter_object_name_suffix_s.used); - } - - const f_string_static_t values[] = { - source, - fake_build_parameter_object_compile_s, - fake_build_parameter_object_static_s, - fake_build_parameter_object_output_s, - destination, - }; - - for (uint8_t k = 0; k < 5; ++k) { - - if (!values[k].used) continue; - - *status = fll_execute_arguments_add(values[k], &arguments); - if (F_status_is_error(*status)) break; - } // for - - fake_build_arguments_standard_add(data, data_build, F_false, fake_build_type_library_e, &arguments, status); - - if (F_status_is_error(*status)) { - fll_error_print(data->main->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); - - break; - } - - result = fake_execute(data, data_build->environment, data_build->setting.build_compiler, arguments, status); - - macro_f_string_dynamics_t_delete_simple(arguments); - - if (F_status_is_error(*status) || *status == F_child) break; - } // for - - if (F_status_is_error(*status) || *status == F_child) break; - } // for - - f_string_dynamic_resize(0, &file_name); - f_string_dynamic_resize(0, &destination_path); - f_string_dynamics_resize(0, &arguments); - - if (F_status_is_error_not(*status) && *status != F_child) { - fake_build_touch(data, file_stage, status); - } - - return result; - } -#endif // _di_fake_build_objects_static_ - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_3/fake/c/private-build-objects.h b/level_3/fake/c/private-build-objects.h deleted file mode 100644 index 68632b4..0000000 --- a/level_3/fake/c/private-build-objects.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * FLL - Level 3 - * - * Project: Featureless Make - * API Version: 0.6 - * Licenses: lgpl-2.1-or-later - */ -#ifndef _PRIVATE_build_objects_h -#define _PRIVATE_build_objects_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Build static options that are needed when building a static library. - * - * This is neither the "build_sources_object" nor the "build_sources_object_static" property. - * Instead, this converts the "build_sources_library" and the "build_sources_library_static" into a static object file so that the indexer program (such as GNU ar) can combine these into a static file. - * - * @param data - * The program data. - * @param data_build - * The build data. - * @param mode - * The file mode. - * @param file_stage - * The specific stage file path. - * @param status - * F_none on success. - * - * Status codes (with error bit) are returned on any problem. - * - * @return - * The return code of the execution process. - * This generally is only needed when F_child is returned, where this holds the return status of the child process. - */ -#ifndef _di_fake_build_objects_static_ - extern int fake_build_objects_static(fake_data_t * const data, fake_build_data_t * const data_build, const f_mode_t mode, const f_string_static_t file_stage, f_status_t * const status) F_attribute_visibility_internal_d; -#endif // _di_fake_build_objects_static_ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_build_objects_h diff --git a/level_3/fake/c/private-build-program.c b/level_3/fake/c/private-build-program.c index 8181f56..e61ef5c 100644 --- a/level_3/fake/c/private-build-program.c +++ b/level_3/fake/c/private-build-program.c @@ -43,7 +43,7 @@ extern "C" { return 0; } - *status = fake_build_sources_add(data, data_build, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_shared, &arguments); + *status = fake_build_sources_add(data, data_build, &data_build->setting.path_sources_program, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_shared, &arguments); if (F_status_is_error(*status)) { fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_add", F_true); @@ -138,7 +138,7 @@ extern "C" { return 0; } - *status = fake_build_sources_add(data, data_build, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_static, &arguments); + *status = fake_build_sources_add(data, data_build, &data_build->setting.path_sources_program, &data_build->setting.build_sources_program, &data_build->setting.build_sources_program_static, &arguments); if (F_status_is_error(*status)) { fll_error_print(data->main->error, F_status_set_fine(*status), "fake_build_sources_add", F_true); @@ -158,7 +158,7 @@ extern "C" { source_library.used = 0; // Only include the library if there are sources that would result in it being built. - if (data_build->setting.build_sources_library.used) { + if (data_build->setting.build_sources_library.used || data_build->setting.build_sources_library_static.used) { memcpy(source_library_string, data->path_build_libraries_static.string, sizeof(f_char_t) * data->path_build_libraries_static.used); source_library.used += data->path_build_libraries_static.used; diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 14228a3..e79af7b 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -5,7 +5,6 @@ #include "private-build-library.h" #include "private-build-load.h" #include "private-build-object.h" -#include "private-build-objects.h" #include "private-build-program.h" #include "private-build-skeleton.h" #include "private-print.h" @@ -110,28 +109,30 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static f_array_length_t i = 0; - for (i = 0; i < data_build->setting.build_libraries.used && F_status_is_error_not(*status); ++i) { + if (type != fake_build_type_object_e) { + for (i = 0; i < data_build->setting.build_libraries.used && F_status_is_error_not(*status); ++i) { - if (!data_build->setting.build_libraries.array[i].used) continue; + if (!data_build->setting.build_libraries.array[i].used) continue; - *status = fll_execute_arguments_add(data_build->setting.build_libraries.array[i], arguments); - } // for + *status = fll_execute_arguments_add(data_build->setting.build_libraries.array[i], arguments); + } // for - if (is_shared) { - for (i = 0; i < data_build->setting.build_libraries_shared.used && F_status_is_error_not(*status); ++i) { + if (is_shared) { + for (i = 0; i < data_build->setting.build_libraries_shared.used && F_status_is_error_not(*status); ++i) { - if (!data_build->setting.build_libraries_shared.array[i].used) continue; + if (!data_build->setting.build_libraries_shared.array[i].used) continue; - *status = fll_execute_arguments_add(data_build->setting.build_libraries_shared.array[i], arguments); - } // for - } - else { - for (i = 0; i < data_build->setting.build_libraries_static.used && F_status_is_error_not(*status); ++i) { + *status = fll_execute_arguments_add(data_build->setting.build_libraries_shared.array[i], arguments); + } // for + } + else { + for (i = 0; i < data_build->setting.build_libraries_static.used && F_status_is_error_not(*status); ++i) { - if (!data_build->setting.build_libraries_static.array[i].used) continue; + if (!data_build->setting.build_libraries_static.array[i].used) continue; - *status = fll_execute_arguments_add(data_build->setting.build_libraries_static.array[i], arguments); - } // for + *status = fll_execute_arguments_add(data_build->setting.build_libraries_static.array[i], arguments); + } // for + } } for (i = 0; i < data_build->setting.flags.used && F_status_is_error_not(*status); ++i) { @@ -670,7 +671,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static data->settings, data->path_build, data->path_data, - data_build->setting.path_sources, + data_build->setting.path_sources_script, data->path_under, data->path_work, }; @@ -918,12 +919,12 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static if (data_build.setting.build_script) { f_string_static_t source = f_string_static_t_initialize; - fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources_script, &source); f_char_t source_string[source.used + fake_path_part_script_s.used + 1]; source.string = source_string; - fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources_script, &source); memcpy(source_string + source.used, fake_path_part_script_s.string, sizeof(f_char_t) * fake_path_part_script_s.used); source.used += fake_path_part_script_s.used; @@ -936,12 +937,12 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static if (data_build.setting.build_sources_headers.used) { f_string_static_t source = f_string_static_t_initialize; - fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources_headers, &source); f_char_t source_string[source.used + 1]; source.string = source_string; - fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources_headers, &source); f_string_static_t path_headers = f_string_static_t_initialize; path_headers.used = data->path_build_includes.used + data_build.setting.path_headers.used; @@ -969,7 +970,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static } if (data_build.setting.build_shared) { - data->main->child = fake_build_object_shared(data, &data_build, mode, stage.file_object_shared, &status); + data->main->child = fake_build_object(data, &data_build, mode, stage.file_object_shared, F_true, &status); data->main->child = fake_build_library_shared(data, &data_build, mode, stage.file_library_shared, &status); @@ -977,9 +978,9 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static } if (data_build.setting.build_static) { - data->main->child = fake_build_object_static(data, &data_build, mode, stage.file_object_static, &status); + data->main->child = fake_build_object(data, &data_build, mode, stage.file_object_static, F_false, &status); - data->main->child = fake_build_objects_static(data, &data_build, mode, stage.file_objects_static, &status); + data->main->child = fake_build_library_static_object(data, &data_build, mode, stage.file_library_static_object, &status); data->main->child = fake_build_library_static(data, &data_build, mode, stage.file_library_static, &status); @@ -989,12 +990,12 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static if (data_build.setting.build_script) { f_string_static_t source = f_string_static_t_initialize; - fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_length(data, &data_build, &data_build.setting.path_sources_script, &source); f_char_t source_string[source.used + fake_path_part_script_s.used + 1]; source.string = source_string; - fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources, &source); + fake_build_path_source_string(data, &data_build, &data_build.setting.path_sources_script, &source); memcpy(source_string + source.used, fake_path_part_script_s.string, sizeof(f_char_t) * fake_path_part_script_s.used); source.used += fake_path_part_script_s.used; @@ -1069,7 +1070,7 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static #endif // _di_fake_build_path_source_string_ #ifndef _di_fake_build_sources_add_ - f_status_t fake_build_sources_add(fake_data_t * const data, 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_status_t fake_build_sources_add(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const source_path, f_string_statics_t * const generic, f_string_statics_t * const specific, f_string_dynamics_t * const arguments) { f_status_t status = F_none; f_array_length_t i = 0; @@ -1088,12 +1089,12 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static if (!sources[i]->array[j].used) continue; - fake_build_path_source_length(data, data_build, &data_build->setting.path_sources, &source); + fake_build_path_source_length(data, data_build, source_path, &source); f_char_t source_string[source.used + sources[i]->array[j].used + 1]; source.string = source_string; - fake_build_path_source_string(data, data_build, &data_build->setting.path_sources, &source); + fake_build_path_source_string(data, data_build, source_path, &source); memcpy(source_string + source.used, sources[i]->array[j].string, sizeof(f_char_t) * sources[i]->array[j].used); source.used += sources[i]->array[j].used; @@ -1109,34 +1110,23 @@ const f_string_static_t fake_build_documentation_files_s = macro_f_string_static #endif // _di_fake_build_sources_add_ #ifndef _di_fake_build_sources_object_add_ - f_status_t fake_build_sources_object_add(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t *generic, const f_string_static_t *specific, f_string_dynamics_t *arguments) { + f_status_t fake_build_sources_object_add(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const file, f_string_dynamics_t * const arguments) { - if (!generic->used && !specific->used) return F_none; + if (!file) return F_none; f_string_static_t source = f_string_static_t_initialize; fake_build_path_source_length(data, data_build, &data_build->setting.path_sources_object, &source); - if (specific->used) { - source.used += specific->used; - } - else { - source.used += generic->used; - } + source.used += file->used; f_char_t source_string[source.used + 1]; source.string = source_string; fake_build_path_source_string(data, data_build, &data_build->setting.path_sources_object, &source); - if (specific->used) { - memcpy(source_string + source.used, specific->string, sizeof(f_char_t) * specific->used); - source.used += specific->used; - } - else { - memcpy(source_string + source.used, generic->string, sizeof(f_char_t) * generic->used); - source.used += generic->used; - } + memcpy(source_string + source.used, file->string, sizeof(f_char_t) * file->used); + source.used += file->used; source_string[source.used] = 0; diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index 25eef13..b22b07b 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -221,9 +221,9 @@ extern "C" { * 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. + * The source.string is not expected to be defined at this point. + * The source.used is updated. + * The source.size is ignored. */ #ifndef _di_fake_build_path_source_length_ extern void fake_build_path_source_length(fake_data_t * const data, 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; @@ -240,9 +240,9 @@ extern "C" { * 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. + * The source.string is expected to be defined and set to a size from source.used + 1. + * The source.used is updated. + * The source.size is ignored. */ #ifndef _di_fake_build_path_source_string_ extern void fake_build_path_source_string(fake_data_t * const data, 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; @@ -255,6 +255,8 @@ extern "C" { * The program data. * @param data_build * The build data. + * @param source_path + * The source path to use, such as data_build.setting.path_sources. * @param generic * The generic sources to add. * @param specific @@ -268,7 +270,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_sources_add_ - extern f_status_t fake_build_sources_add(fake_data_t * const data, 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_attribute_visibility_internal_d; + extern f_status_t fake_build_sources_add(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const source_path, f_string_statics_t * const generic, f_string_statics_t * const specific, f_string_dynamics_t * const arguments) F_attribute_visibility_internal_d; #endif // _di_fake_build_sources_add_ /** @@ -278,10 +280,8 @@ extern "C" { * The program data. * @param data_build * The build data. - * @param generic - * The generic sources to add. - * @param specific - * The specific sources to add. + * @param file + * The source object file to add. * @param arguments * The execute arguments array being updated. * @@ -291,7 +291,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_build_sources_object_add_ - extern f_status_t fake_build_sources_object_add(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t *generic, const f_string_static_t *specific, f_string_dynamics_t *arguments) F_attribute_visibility_internal_d; + extern f_status_t fake_build_sources_object_add(fake_data_t * const data, fake_build_data_t * const data_build, f_string_static_t * const file, f_string_dynamics_t * const arguments) F_attribute_visibility_internal_d; #endif // _di_fake_build_sources_object_add_ /** diff --git a/level_3/fake/c/private-common.c b/level_3/fake/c/private-common.c index 0fd46d2..c27bbae 100644 --- a/level_3/fake/c/private-common.c +++ b/level_3/fake/c/private-common.c @@ -84,7 +84,11 @@ extern "C" { const f_string_static_t fake_build_setting_name_path_program_shared_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_program_shared_s, 0, FAKE_build_setting_name_path_program_shared_s_length); const f_string_static_t fake_build_setting_name_path_program_static_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_program_static_s, 0, FAKE_build_setting_name_path_program_static_s_length); const f_string_static_t fake_build_setting_name_path_sources_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_s, 0, FAKE_build_setting_name_path_sources_s_length); + const f_string_static_t fake_build_setting_name_path_sources_headers_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_headers_s, 0, FAKE_build_setting_name_path_sources_headers_s_length); + const f_string_static_t fake_build_setting_name_path_sources_library_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_library_s, 0, FAKE_build_setting_name_path_sources_library_s_length); const f_string_static_t fake_build_setting_name_path_sources_object_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_object_s, 0, FAKE_build_setting_name_path_sources_object_s_length); + const f_string_static_t fake_build_setting_name_path_sources_program_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_program_s, 0, FAKE_build_setting_name_path_sources_program_s_length); + const f_string_static_t fake_build_setting_name_path_sources_script_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_path_sources_script_s, 0, FAKE_build_setting_name_path_sources_script_s_length); const f_string_static_t fake_build_setting_name_preserve_path_headers_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_preserve_path_headers_s, 0, FAKE_build_setting_name_preserve_path_headers_s_length); const f_string_static_t fake_build_setting_name_process_post_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_process_post_s, 0, FAKE_build_setting_name_process_post_s_length); const f_string_static_t fake_build_setting_name_process_pre_s = macro_f_string_static_t_initialize(FAKE_build_setting_name_process_pre_s, 0, FAKE_build_setting_name_process_pre_s_length); @@ -108,6 +112,7 @@ extern "C" { const f_string_static_t fake_build_stage_library_script_s = macro_f_string_static_t_initialize(FAKE_build_stage_library_script_s, 0, FAKE_build_stage_library_script_s_length); const f_string_static_t fake_build_stage_library_shared_s = macro_f_string_static_t_initialize(FAKE_build_stage_library_shared_s, 0, FAKE_build_stage_library_shared_s_length); const f_string_static_t fake_build_stage_library_static_s = macro_f_string_static_t_initialize(FAKE_build_stage_library_static_s, 0, FAKE_build_stage_library_static_s_length); + const f_string_static_t fake_build_stage_library_static_object_s = macro_f_string_static_t_initialize(FAKE_build_stage_library_static_object_s, 0, FAKE_build_stage_library_static_object_s_length); const f_string_static_t fake_build_stage_object_script_s = macro_f_string_static_t_initialize(FAKE_build_stage_object_script_s, 0, FAKE_build_stage_object_script_s_length); const f_string_static_t fake_build_stage_object_shared_s = macro_f_string_static_t_initialize(FAKE_build_stage_object_shared_s, 0, FAKE_build_stage_object_shared_s_length); const f_string_static_t fake_build_stage_object_static_s = macro_f_string_static_t_initialize(FAKE_build_stage_object_static_s, 0, FAKE_build_stage_object_static_s_length); diff --git a/level_3/fake/c/private-common.h b/level_3/fake/c/private-common.h index f3484c0..711c340 100644 --- a/level_3/fake/c/private-common.h +++ b/level_3/fake/c/private-common.h @@ -233,9 +233,6 @@ extern "C" { * build_compiler: The build_compiler setting. * build_indexer: The build_indexer setting. * build_name: The build_name setting. - * build_sources_object: The build_sources_object setting. - * build_sources_object_shared: The build_sources_object_shared setting. - * build_sources_object_static: The build_sources_object_static setting. * path_headers: The path_headers setting. * path_language: The path_language setting. * path_library_script: The path_library_script setting. @@ -248,7 +245,11 @@ extern "C" { * path_program_shared: The path_program_shared setting. * path_program_static: The path_program_static setting. * path_sources: The path_sources setting. + * path_sources_headers: The path_sources_headers setting. + * path_sources_library: The path_sources_library setting. * path_sources_object: The path_sources_object setting. + * path_sources_program: The path_sources_program setting. + * path_sources_script: The path_sources_script setting. * process_post: The process_post setting. * process_pre: The process_pre setting. * version_major: The version_major setting. @@ -277,6 +278,9 @@ extern "C" { * build_sources_library: The build_sources_library setting. * build_sources_library_shared: The build_sources_library_shared setting. * build_sources_library_static: The build_sources_library_static setting. + * build_sources_object: The build_sources_object setting. + * build_sources_object_shared: The build_sources_object_shared setting. + * build_sources_object_static: The build_sources_object_static setting. * build_sources_program: The build_sources_program setting. * build_sources_program_shared: The build_sources_program_shared setting. * build_sources_program_static: The build_sources_program_static setting. @@ -337,9 +341,6 @@ extern "C" { f_string_dynamic_t build_compiler; f_string_dynamic_t build_indexer; f_string_dynamic_t build_name; - f_string_dynamic_t build_sources_object; - f_string_dynamic_t build_sources_object_shared; - f_string_dynamic_t build_sources_object_static; f_string_dynamic_t path_headers; f_string_dynamic_t path_language; f_string_dynamic_t path_library_script; @@ -352,7 +353,11 @@ extern "C" { f_string_dynamic_t path_program_shared; f_string_dynamic_t path_program_static; f_string_dynamic_t path_sources; + f_string_dynamic_t path_sources_headers; + f_string_dynamic_t path_sources_library; f_string_dynamic_t path_sources_object; + f_string_dynamic_t path_sources_program; + f_string_dynamic_t path_sources_script; f_string_dynamic_t process_post; f_string_dynamic_t process_pre; f_string_dynamic_t version_major; @@ -371,6 +376,9 @@ extern "C" { f_string_dynamics_t build_objects_library; f_string_dynamics_t build_objects_library_shared; f_string_dynamics_t build_objects_library_static; + f_string_dynamics_t build_sources_object; + f_string_dynamics_t build_sources_object_shared; + f_string_dynamics_t build_sources_object_static; f_string_dynamics_t build_objects_program; f_string_dynamics_t build_objects_program_shared; f_string_dynamics_t build_objects_program_static; @@ -457,6 +465,10 @@ extern "C" { 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_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ @@ -512,9 +524,6 @@ extern "C" { macro_f_string_dynamic_t_delete_simple(setting.build_compiler) \ macro_f_string_dynamic_t_delete_simple(setting.build_indexer) \ macro_f_string_dynamic_t_delete_simple(setting.build_name) \ - macro_f_string_dynamic_t_delete_simple(setting.build_sources_object) \ - macro_f_string_dynamic_t_delete_simple(setting.build_sources_object_shared) \ - macro_f_string_dynamic_t_delete_simple(setting.build_sources_object_static) \ macro_f_string_dynamic_t_delete_simple(setting.path_headers) \ macro_f_string_dynamic_t_delete_simple(setting.path_language) \ macro_f_string_dynamic_t_delete_simple(setting.path_library_script) \ @@ -527,7 +536,11 @@ extern "C" { macro_f_string_dynamic_t_delete_simple(setting.path_program_shared) \ macro_f_string_dynamic_t_delete_simple(setting.path_program_static) \ macro_f_string_dynamic_t_delete_simple(setting.path_sources) \ + macro_f_string_dynamic_t_delete_simple(setting.path_sources_headers) \ + macro_f_string_dynamic_t_delete_simple(setting.path_sources_library) \ macro_f_string_dynamic_t_delete_simple(setting.path_sources_object) \ + macro_f_string_dynamic_t_delete_simple(setting.path_sources_program) \ + macro_f_string_dynamic_t_delete_simple(setting.path_sources_script) \ macro_f_string_dynamic_t_delete_simple(setting.process_post) \ macro_f_string_dynamic_t_delete_simple(setting.process_pre) \ macro_f_string_dynamic_t_delete_simple(setting.version_major) \ @@ -555,6 +568,9 @@ extern "C" { macro_f_string_dynamics_t_delete_simple(setting.build_sources_library) \ macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_shared) \ macro_f_string_dynamics_t_delete_simple(setting.build_sources_library_static) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_object) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_object_shared) \ + macro_f_string_dynamics_t_delete_simple(setting.build_sources_object_static) \ macro_f_string_dynamics_t_delete_simple(setting.build_sources_program) \ macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_shared) \ macro_f_string_dynamics_t_delete_simple(setting.build_sources_program_static) \ @@ -666,7 +682,11 @@ extern "C" { #define FAKE_build_setting_name_path_program_shared_s "path_program_shared" #define FAKE_build_setting_name_path_program_static_s "path_program_static" #define FAKE_build_setting_name_path_sources_s "path_sources" + #define FAKE_build_setting_name_path_sources_headers_s "path_sources_headers" + #define FAKE_build_setting_name_path_sources_library_s "path_sources_library" #define FAKE_build_setting_name_path_sources_object_s "path_sources_object" + #define FAKE_build_setting_name_path_sources_program_s "path_sources_program" + #define FAKE_build_setting_name_path_sources_script_s "path_sources_script" #define FAKE_build_setting_name_preserve_path_headers_s "preserve_path_headers" #define FAKE_build_setting_name_process_post_s "process_post" #define FAKE_build_setting_name_process_pre_s "process_pre" @@ -762,7 +782,11 @@ extern "C" { #define FAKE_build_setting_name_path_program_shared_s_length 19 #define FAKE_build_setting_name_path_program_static_s_length 19 #define FAKE_build_setting_name_path_sources_s_length 12 + #define FAKE_build_setting_name_path_sources_headers_s_length 20 + #define FAKE_build_setting_name_path_sources_library_s_length 20 #define FAKE_build_setting_name_path_sources_object_s_length 19 + #define FAKE_build_setting_name_path_sources_program_s_length 20 + #define FAKE_build_setting_name_path_sources_script_s_length 19 #define FAKE_build_setting_name_preserve_path_headers_s_length 21 #define FAKE_build_setting_name_process_post_s_length 12 #define FAKE_build_setting_name_process_pre_s_length 11 @@ -858,7 +882,11 @@ extern "C" { extern const f_string_static_t fake_build_setting_name_path_program_shared_s; extern const f_string_static_t fake_build_setting_name_path_program_static_s; extern const f_string_static_t fake_build_setting_name_path_sources_s; + extern const f_string_static_t fake_build_setting_name_path_sources_headers_s; + extern const f_string_static_t fake_build_setting_name_path_sources_library_s; extern const f_string_static_t fake_build_setting_name_path_sources_object_s; + extern const f_string_static_t fake_build_setting_name_path_sources_program_s; + extern const f_string_static_t fake_build_setting_name_path_sources_script_s; extern const f_string_static_t fake_build_setting_name_preserve_path_headers_s; extern const f_string_static_t fake_build_setting_name_process_post_s; extern const f_string_static_t fake_build_setting_name_process_pre_s; @@ -876,7 +904,7 @@ extern "C" { extern const f_string_static_t fake_build_setting_name_version_nano_prefix_s; extern const f_string_static_t fake_build_setting_name_version_target_s; - #define fake_build_setting_total_d 89 + #define fake_build_setting_total_d 93 #endif // _di_fake_build_setting_t_ #ifndef _di_fake_build_stage_t_ @@ -884,6 +912,7 @@ extern "C" { f_string_dynamic_t file_library_script; f_string_dynamic_t file_library_shared; f_string_dynamic_t file_library_static; + f_string_dynamic_t file_library_static_object; f_string_dynamic_t file_object_script; f_string_dynamic_t file_object_shared; f_string_dynamic_t file_object_static; @@ -918,14 +947,16 @@ extern "C" { f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ } - #define fake_build_stage_total_d 17 + #define fake_build_stage_total_d 18 #define macro_fake_build_stage_t_delete_simple(stage) \ macro_f_string_dynamic_t_delete_simple(stage.file_library_script) \ macro_f_string_dynamic_t_delete_simple(stage.file_library_shared) \ macro_f_string_dynamic_t_delete_simple(stage.file_library_static) \ + macro_f_string_dynamic_t_delete_simple(stage.file_library_static_object) \ macro_f_string_dynamic_t_delete_simple(stage.file_object_script) \ macro_f_string_dynamic_t_delete_simple(stage.file_object_shared) \ macro_f_string_dynamic_t_delete_simple(stage.file_object_static) \ @@ -945,6 +976,7 @@ extern "C" { #define FAKE_build_stage_library_script_s "library_script" #define FAKE_build_stage_library_shared_s "library_shared" #define FAKE_build_stage_library_static_s "library_static" + #define FAKE_build_stage_library_static_object_s "library_static_object" #define FAKE_build_stage_object_script_s "object_script" #define FAKE_build_stage_object_shared_s "object_shared" #define FAKE_build_stage_object_static_s "object_static" @@ -965,6 +997,7 @@ extern "C" { #define FAKE_build_stage_library_script_s_length 14 #define FAKE_build_stage_library_shared_s_length 14 #define FAKE_build_stage_library_static_s_length 14 + #define FAKE_build_stage_library_static_object_s_length 21 #define FAKE_build_stage_object_script_s_length 13 #define FAKE_build_stage_object_shared_s_length 13 #define FAKE_build_stage_object_static_s_length 13 @@ -985,6 +1018,7 @@ extern "C" { extern const f_string_static_t fake_build_stage_library_script_s; extern const f_string_static_t fake_build_stage_library_shared_s; extern const f_string_static_t fake_build_stage_library_static_s; + extern const f_string_static_t fake_build_stage_library_static_object_s; extern const f_string_static_t fake_build_stage_object_script_s; extern const f_string_static_t fake_build_stage_object_shared_s; extern const f_string_static_t fake_build_stage_object_static_s; diff --git a/level_3/fake/c/private-make-operate.c b/level_3/fake/c/private-make-operate.c index 24a6b5c..2ab7687 100644 --- a/level_3/fake/c/private-make-operate.c +++ b/level_3/fake/c/private-make-operate.c @@ -962,6 +962,9 @@ extern "C" { fake_build_setting_name_path_library_script_s, fake_build_setting_name_path_library_shared_s, fake_build_setting_name_path_library_static_s, + fake_build_setting_name_path_object_script_s, + fake_build_setting_name_path_object_shared_s, + fake_build_setting_name_path_object_static_s, fake_build_setting_name_path_program_script_s, fake_build_setting_name_path_program_shared_s, fake_build_setting_name_path_program_static_s, @@ -982,6 +985,9 @@ extern "C" { data_make->setting_build.path_library_script, data_make->setting_build.path_library_shared, data_make->setting_build.path_library_static, + data_make->setting_build.path_object_script, + data_make->setting_build.path_object_shared, + data_make->setting_build.path_object_static, data_make->setting_build.path_program_script, data_make->setting_build.path_program_shared, data_make->setting_build.path_program_static, @@ -993,7 +999,7 @@ extern "C" { data_make->setting_build.version_minor, }; - for (uint8_t i = 0; i < 17; ++i) { + for (uint8_t i = 0; i < 20; ++i) { status = fl_string_dynamic_partial_compare_string(dynamic_name[i].string, data_make->buffer, dynamic_name[i].used, range_name); @@ -1019,6 +1025,9 @@ extern "C" { fake_build_setting_name_build_sources_library_s, fake_build_setting_name_build_sources_library_shared_s, fake_build_setting_name_build_sources_library_static_s, + fake_build_setting_name_build_sources_object_s, + fake_build_setting_name_build_sources_object_shared_s, + fake_build_setting_name_build_sources_object_static_s, fake_build_setting_name_build_sources_program_s, fake_build_setting_name_build_sources_program_shared_s, fake_build_setting_name_build_sources_program_static_s, @@ -1028,6 +1037,9 @@ extern "C" { fake_build_setting_name_defines_library_s, fake_build_setting_name_defines_library_shared_s, fake_build_setting_name_defines_library_static_s, + fake_build_setting_name_defines_object_s, + fake_build_setting_name_defines_object_shared_s, + fake_build_setting_name_defines_object_static_s, fake_build_setting_name_defines_program_s, fake_build_setting_name_defines_program_shared_s, fake_build_setting_name_defines_program_static_s, @@ -1038,6 +1050,9 @@ extern "C" { fake_build_setting_name_flags_library_s, fake_build_setting_name_flags_library_shared_s, fake_build_setting_name_flags_library_static_s, + fake_build_setting_name_flags_object_s, + fake_build_setting_name_flags_object_shared_s, + fake_build_setting_name_flags_object_static_s, fake_build_setting_name_flags_program_s, fake_build_setting_name_flags_program_shared_s, fake_build_setting_name_flags_program_static_s, @@ -1058,6 +1073,9 @@ extern "C" { data_make->setting_build.build_sources_library, data_make->setting_build.build_sources_library_shared, data_make->setting_build.build_sources_library_static, + data_make->setting_build.build_sources_object, + data_make->setting_build.build_sources_object_shared, + data_make->setting_build.build_sources_object_static, data_make->setting_build.build_sources_program, data_make->setting_build.build_sources_program_shared, data_make->setting_build.build_sources_program_static, @@ -1067,6 +1085,9 @@ extern "C" { data_make->setting_build.defines_library, data_make->setting_build.defines_library_shared, data_make->setting_build.defines_library_static, + data_make->setting_build.defines_object, + data_make->setting_build.defines_object_shared, + data_make->setting_build.defines_object_static, data_make->setting_build.defines_program, data_make->setting_build.defines_program_shared, data_make->setting_build.defines_program_static, @@ -1077,6 +1098,9 @@ extern "C" { data_make->setting_build.flags_library, data_make->setting_build.flags_library_shared, data_make->setting_build.flags_library_static, + data_make->setting_build.flags_object, + data_make->setting_build.flags_object_shared, + data_make->setting_build.flags_object_static, data_make->setting_build.flags_program, data_make->setting_build.flags_program_shared, data_make->setting_build.flags_program_static, @@ -1097,6 +1121,9 @@ extern "C" { 0, // build_sources_library 0, // build_sources_library_shared 0, // build_sources_library_static + 0, // build_sources_object + 0, // build_sources_object_shared + 0, // build_sources_object_static 0, // build_sources_program 0, // build_sources_program_shared 0, // build_sources_program_static @@ -1106,6 +1133,9 @@ extern "C" { 0, // defines_library 0, // defines_library_shared 0, // defines_library_static + 0, // defines_object + 0, // defines_object_shared + 0, // defines_object_static 0, // defines_program 0, // defines_program_shared 0, // defines_program_static @@ -1116,6 +1146,9 @@ extern "C" { 0, // flags_library 0, // flags_library_shared 0, // flags_library_static + 0, // flags_object + 0, // flags_object_shared + 0, // flags_object_static 0, // flags_program 0, // flags_program_shared 0, // flags_program_static @@ -1125,7 +1158,7 @@ extern "C" { 0, // modes_default }; - for (uint8_t i = 0; i < 36; ++i) { + for (uint8_t i = 0; i < 45; ++i) { status = fl_string_dynamic_partial_compare_string(dynamics_name[i].string, data_make->buffer, dynamics_name[i].used, range_name); diff --git a/level_3/fake/c/private-skeleton.h b/level_3/fake/c/private-skeleton.h index 66df779..61e9fa7 100644 --- a/level_3/fake/c/private-skeleton.h +++ b/level_3/fake/c/private-skeleton.h @@ -79,9 +79,9 @@ extern "C" { * 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. + * The source.string is not expected to be defined at this point. + * The source.used is updated. + * The source.size is ignored. */ #ifndef _di_fake_skeleton_path_source_length_ extern void fake_skeleton_path_source_length(fake_data_t * const data, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d; @@ -96,9 +96,9 @@ extern "C" { * 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. + * The source.string is expected to be defined and set to a size from source.used + 1. + * The source.used is updated. + * The source.size is ignored. */ #ifndef _di_fake_skeleton_path_source_string_ extern void fake_skeleton_path_source_string(fake_data_t * const data, const f_string_static_t *partial, f_string_static_t * const source) F_attribute_visibility_internal_d; diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index e3956c4..6c4435d 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -43,7 +43,7 @@ build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library fake.c common.c -build_sources_library private-build.c private-build-library.c private-build-load.c private-build-object.c private-build-objects.c private-build-program.c private-build-skeleton.c +build_sources_library private-build.c private-build-library.c private-build-load.c private-build-object.c private-build-program.c private-build-skeleton.c build_sources_library private-clean.c private-common.c private-make.c private-print.c private-skeleton.c build_sources_library private-make-load_fakefile.c private-make-load_parameters.c build_sources_library private-make-operate.c private-make-operate_block.c private-make-operate_process.c private-make-operate_process_type.c private-make-operate_validate.c private-make-operate_validate_type.c diff --git a/level_3/fake/data/documentation/man/man5/fake-defines.5 b/level_3/fake/data/documentation/man/man5/fake-defines.5 index 42a55af..9e0a4c2 100644 --- a/level_3/fake/data/documentation/man/man5/fake-defines.5 +++ b/level_3/fake/data/documentation/man/man5/fake-defines.5 @@ -1,4 +1,4 @@ -.TH fake-defines "5" "February 2024" "FLL - Featureless Make 0.6.10" "File Formats" +.TH fake-defines "5" "March 2024" "FLL - Featureless Make 0.6.10" "File Formats" .SH NAME Featureless Make \- "defines" file. .SH SYNOPSIS diff --git a/level_3/fake/data/documentation/man/man5/fake-depedencies.5 b/level_3/fake/data/documentation/man/man5/fake-depedencies.5 index 1163973..4aa160a 100644 --- a/level_3/fake/data/documentation/man/man5/fake-depedencies.5 +++ b/level_3/fake/data/documentation/man/man5/fake-depedencies.5 @@ -1,4 +1,4 @@ -.TH fake-dependencies "5" "February 2024" "FLL - Featureless Make 0.6.10" "File Formats" +.TH fake-dependencies "5" "March 2024" "FLL - Featureless Make 0.6.10" "File Formats" .SH NAME Featureless Make \- "dependencies" file. .SH SYNOPSIS diff --git a/level_3/fake/data/documentation/man/man5/fake-fakefile.5 b/level_3/fake/data/documentation/man/man5/fake-fakefile.5 index edcae5f..f2a9305 100644 --- a/level_3/fake/data/documentation/man/man5/fake-fakefile.5 +++ b/level_3/fake/data/documentation/man/man5/fake-fakefile.5 @@ -1,4 +1,4 @@ -.TH fake-fakefile "5" "February 2024" "FLL - Featureless Make 0.6.10" "File Formats" +.TH fake-fakefile "5" "March 2024" "FLL - Featureless Make 0.6.10" "File Formats" .SH NAME Featureless Make \- "fakefile" file. .SH SYNOPSIS diff --git a/level_3/fake/data/documentation/man/man5/fake-settings.5 b/level_3/fake/data/documentation/man/man5/fake-settings.5 index 8ed7207..b8dd7ed 100644 --- a/level_3/fake/data/documentation/man/man5/fake-settings.5 +++ b/level_3/fake/data/documentation/man/man5/fake-settings.5 @@ -1,4 +1,4 @@ -.TH fake-settings "5" "February 2024" "FLL - Featureless Make 0.6.10" "File Formats" +.TH fake-settings "5" "March 2024" "FLL - Featureless Make 0.6.10" "File Formats" .SH NAME Featureless Make \- "settings" file. .SH SYNOPSIS diff --git a/level_3/fake/data/projects/example/return_code.fakefile b/level_3/fake/data/projects/example/return_code.fakefile index e6da3ba..7d741fb 100644 --- a/level_3/fake/data/projects/example/return_code.fakefile +++ b/level_3/fake/data/projects/example/return_code.fakefile @@ -21,7 +21,7 @@ main: print print "Simulating Failure Return:" - # Trigger an error, if "exit" doesn't exist then this is an error but if it does then exit with value 1 to represent an error. + # Trigger an error, if "exit" doesn't exist then this is an error but if it does exist, then exit with value 1 to represent an error shell exit 1 print "Return code is 'parameter:"return"'." diff --git a/level_3/fake/documents/fakefile.txt b/level_3/fake/documents/fakefile.txt index a3057a7..f557b6c 100644 --- a/level_3/fake/documents/fakefile.txt +++ b/level_3/fake/documents/fakefile.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named fakefile.txt) can be more easily read using the following iki_read commands: # iki_read fakefile.txt +Q -w -rrr ASCII ASCII GCC GCC HTML HTML -WW character "'" "'" code '"' '"' @@ -338,9 +339,9 @@ Fakefile Documentation: - code:"current": The absolute path to the current working directory (present working directory) (Always has a trailing forward slash). - code:"data": Associated with code:"-D/--data" parameter. - code:"define": Associated with code:"-d/--define" parameter. - - code:"documents": Associated with code:"-O/--documents" parameter (This is neither implemented nor supported by Featureless Make 0.6.x and earlier). + - code:"documents": Associated with code:"-O/--documents" parameter. - code:"fakefile": Associated with code:"-f/--fakefile" parameter. - - code:"licenses": Associated with code:"-l/--licenses" parameter (This is neither implemented nor supported by Featureless Make 0.6.x and earlier). + - code:"licenses": Associated with code:"-l/--licenses" parameter. - code:"mode": Associated with code:"-m/--mode" parameter and possibly with the build settings default mode code:"modes_default". - code:"process": Associated with code:"-p/--process" parameter. - code:"return": Contains the return value of a previous operation that produces a return code. @@ -617,7 +618,7 @@ Fakefile Documentation: This supports both code:":option" and code:":value". - code:"under"\: - This variable holds the code:"under" program parameters, such as code:"-U build/". + This variable holds the code:"under" program parameters, such as code:"-U under/". This supports both code:":option" and code:":value". - code:"verbosity"\: diff --git a/level_3/fake/documents/settings.txt b/level_3/fake/documents/settings.txt index b8818da..793a364 100644 --- a/level_3/fake/documents/settings.txt +++ b/level_3/fake/documents/settings.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named settings.txt) can be more easily read using the following iki_read commands: # iki_read settings.txt +Q -w -rrr ASCII ASCII FLL FLL GCC GCC -WW character "'" "'" code '"' '"' @@ -103,8 +104,7 @@ Settings Documentation: - code:"build_script"\: When code:"yes", the build process will build any scripts, such as a Bash script. - - This is neither implemented nor supported by Featureless Make 0.6.x and earlier. + This is currently not implemented. - code:"build_shared"\: When code:"yes", the build process will compile any source code for any supported language that supports shared library linking. @@ -152,26 +152,29 @@ Settings Documentation: These are applied to only static builds. - code:"build_sources_object"\: - A single source file used for generating an object file. - The source file is located within the path designated by code:"path_sources_object". - The built object does not get linked and therefore no linker arguments apply. - The built object file is named using the code:"build_name" with the code:".o" extension. - May include a relative sub-path to each individual source file (such as: code:"level_0/a.c"). + A collection of source files used for generating an object file with the same name as each source file. + The source files are located within the path designated by code:"path_sources_object". + The built objects do not get linked and therefore no linker arguments apply. + The built object files are named using the same name as the file with the file extension changed to the code:".o" extension. + May include a relative sub-path to each individual source file (such as: code:"level_0/a.c level_0/b.c"). + This is different from code:"build_sources_object" in that multiple files are supported and multiple object files are created. - code:"build_sources_object_shared"\: - A single source file used for generating an object file. - The source file is located within the path designated by code:"path_sources_object". - The built object does not get linked and therefore no linker arguments apply. - The built object file is named using the code:"build_name" with the code:".o" extension. - May include a relative sub-path to each individual source file (such as: code:"level_0/a.c"). + A collection of source files used for generating an object file with the same name as each source file. + The source files are located within the path designated by code:"path_sources_object". + The built objects do not get linked and therefore no linker arguments apply. + The built object files are named using the same name as the file with the file extension changed to the code:".o" extension. + May include a relative sub-path to each individual source file (such as: code:"level_0/a.c level_0/b.c"). + This is different from code:"build_sources_object" in that multiple files are supported and multiple object files are created. These are applied to only shared builds. - code:"build_sources_object_static"\: - A single source file used for generating an object file. - The source file is located within the path designated by code:"path_sources_object". - The built object does not get linked and therefore no linker arguments apply. - The built object file is named using the code:"build_name" with the code:".o" extension. - May include a relative sub-path to each individual source file (such as: code:"level_0/a.c"). + A collection of source files used for generating an object file with the same name as each source file. + The source files are located within the path designated by code:"path_sources_object". + The built objects do not get linked and therefore no linker arguments apply. + The built object files are named using the same name as the file with the file extension changed to the code:".o" extension. + May include a relative sub-path to each individual source file (such as: code:"level_0/a.c level_0/b.c"). + This is different from code:"build_sources_object" in that multiple files are supported and multiple object files are created. These are applied to only static builds. - code:"build_sources_program"\: @@ -387,8 +390,7 @@ Settings Documentation: A sub-path representing the destination where the built library script files are placed. This defaults to code:"script". - - This is neither implemented nor supported by Featureless Make 0.6.x and earlier. + This is currently not implemented. - code:"path_library_shared"\: A sub-path representing the destination where the built shared library files are placed. @@ -404,8 +406,7 @@ Settings Documentation: A sub-path representing the destination where the built object script files are placed. This defaults to code:"script". - - This is neither implemented nor supported by Featureless Make 0.6.x and earlier. + This is currently not implemented. - code:"path_object_shared"\: A sub-path representing the destination where the built object library files are placed. @@ -421,8 +422,7 @@ Settings Documentation: A sub-path representing the destination where the built program script files are placed. This defaults to code:"script". - - This is neither implemented nor supported by Featureless Make 0.6.x and earlier. + This is currently not implemented. - code:"path_program_shared"\: A sub-path representing the destination where the built shared program files are placed. @@ -439,12 +439,36 @@ Settings Documentation: This defaults to code:"sources". + - code:"path_sources_headers"\: + A sub-path representing where the header source files are found. + This is used by code:"build_sources_headers". + + This defaults to code:"sources". + + - code:"path_sources_library"\: + A sub-path representing where the library source files are found. + This is used by code:"build_sources_library". + + This defaults to code:"sources". + - code:"path_sources_object"\: A sub-path representing where the object source files are found. This is used by code:"build_sources_object". This defaults to code:"sources". + - code:"path_sources_program"\: + A sub-path representing where the program source files are found. + This is used by code:"build_sources_program". + + This defaults to code:"sources". + + - code:"path_sources_script"\: + A sub-path representing where the script source files are found. + This is used by code:"build_sources_script". + + This defaults to code:"sources". + - code:"preserve_path_headers"\: When this is code:"yes", then the relative directory structure in the source (as defined in code:"build_sources_headers") is preserved. If the code:"build_sources_headers" has the header files code:"xxx/a.h yyy/zzz/b.h" and this is code:"yes", then the directories code:"xxx/" and code:"yyy/zzz/" are created and the files are stored within them. diff --git a/level_3/fake/specifications/defines.txt b/level_3/fake/specifications/defines.txt index efc35a3..b85fb6b 100644 --- a/level_3/fake/specifications/defines.txt +++ b/level_3/fake/specifications/defines.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named defines.txt) can be more easily read using the following iki_read commands: # iki_read defines.txt +Q -w -WW code '"' '"' bold '"' '"' diff --git a/level_3/fake/specifications/dependencies.txt b/level_3/fake/specifications/dependencies.txt index ad4266f..0983e5c 100644 --- a/level_3/fake/specifications/dependencies.txt +++ b/level_3/fake/specifications/dependencies.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named dependencies.txt) can be more easily read using the following iki_read commands: # iki_read dependencies.txt +Q -w -r FLL FLL -WW code '"' '"' bold '"' '"' diff --git a/level_3/fake/specifications/fakefile.txt b/level_3/fake/specifications/fakefile.txt index 169c45d..640dd4a 100644 --- a/level_3/fake/specifications/fakefile.txt +++ b/level_3/fake/specifications/fakefile.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named fakefile.txt) can be more easily read using the following iki_read commands: # iki_read fakefile.txt +Q -w -WW character "'" "'" code '"' '"' @@ -125,5 +126,5 @@ Fakefile Specification: The code:"if" bold:"Section Operation" condition code:"parameter"\: The following reserved words are available for parameter names: code:"build", code:"color", code:"current", code:"data", code:"documents", code:"define", code:"fakefile", code:"licenses", code:"mode", code:"process", code:"return", code:"settings", code:"sources", code:"top", code:"under", code:"verbosity", and code:"work". - The reserved words code:"documents" and code:"licenses" are neither implemented nor supported by Featureless Make 0.6.x and earlier) + The reserved words code:"documents" and code:"licenses" are neither implemented nor supported by Featureless Make 0.6.x and earlier). Each of the reserved words supports having code:":option" and code:":value" appended, such as: code:"work:value". diff --git a/level_3/fake/specifications/settings.txt b/level_3/fake/specifications/settings.txt index 5afe3e9..4121a80 100644 --- a/level_3/fake/specifications/settings.txt +++ b/level_3/fake/specifications/settings.txt @@ -1,6 +1,7 @@ # fss-0002 iki-0000 # # license: open-standard-license-1.0 +# version 2024/03/23 # # This file (assumed to be named settings.txt) can be more easily read using the following iki_read commands: # iki_read settings.txt +Q -w -WW character "'" "'" code '"' '"' @@ -92,7 +93,11 @@ Settings Specification: - code:"path_program_shared": Must be a single valid path. - code:"path_program_static": Must be a single valid path. - code:"path_sources": Must only be a valid directory path or not specified. + - code:"path_sources_headers": Must only be a valid directory path or not specified. + - code:"path_sources_library": Must only be a valid directory path or not specified. - code:"path_sources_object": Must only be a valid directory path or not specified. + - code:"path_sources_program": Must only be a valid directory path or not specified. + - code:"path_sources_script": Must only be a valid directory path or not specified. - code:"preserve_path_headers": Must only be one of code:"yes" or code:"no". - code:"process_post": Only one bold:"Content", which must only be a valid filename. - code:"process_pre": Only one bold:"Content", which must only be a valid filename. -- 1.8.3.1