From ef74d1c44d68c54f1f62c055969a28c7e299bd6f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 6 Jun 2020 20:21:26 -0500 Subject: [PATCH] Feature: add version_target setting to Featureless Make and FLL generate script I noticed that I had a different linker version string between Featureless Make and the FLL generate script. After reviewing and fixing, I decided to make this a customizable option now called version_target. The default, traditional behavior, is to use only the major version. A major version target would link like "-Wl,-soname,libfake.so.0". A minor version target would link like "-Wl,-soname,libfake.so.0.5". A micro version target would link like "-Wl,-soname,libfake.so.0.5.0". --- build/level_0/settings | 1 + build/level_1/settings | 1 + build/level_2/settings | 1 + build/monolithic/settings | 1 + build/scripts/generate.sh | 51 ++++++---- level_0/f_color/data/build/settings | 1 + level_0/f_console/data/build/settings | 1 + level_0/f_conversion/data/build/settings | 1 + level_0/f_directory/data/build/settings | 1 + level_0/f_environment/data/build/settings | 1 + level_0/f_file/data/build/settings | 1 + level_0/f_fss/data/build/settings | 1 + level_0/f_memory/data/build/settings | 1 + level_0/f_path/data/build/settings | 1 + level_0/f_pipe/data/build/settings | 1 + level_0/f_print/data/build/settings | 1 + level_0/f_serialized/data/build/settings | 1 + level_0/f_socket/data/build/settings | 1 + level_0/f_status/data/build/settings | 1 + level_0/f_string/data/build/settings | 1 + level_0/f_type/data/build/settings | 1 + level_0/f_utf/data/build/settings | 1 + level_1/fl_color/data/build/settings | 1 + level_1/fl_console/data/build/settings | 1 + level_1/fl_directory/data/build/settings | 1 + level_1/fl_file/data/build/settings | 1 + level_1/fl_fss/data/build/settings | 1 + level_1/fl_print/data/build/settings | 1 + level_1/fl_serialized/data/build/settings | 1 + level_1/fl_socket/data/build/settings | 1 + level_1/fl_status/data/build/settings | 1 + level_1/fl_string/data/build/settings | 1 + level_1/fl_utf/data/build/settings | 1 + level_1/fl_utf_file/data/build/settings | 1 + level_2/fll_directory/data/build/settings | 1 + level_2/fll_execute/data/build/settings | 1 + level_2/fll_file/data/build/settings | 1 + level_2/fll_fss/data/build/settings | 1 + level_2/fll_program/data/build/settings | 1 + level_2/fll_status/data/build/settings | 1 + level_3/byte_dump/data/build/settings | 1 + level_3/fake/c/fake.h | 16 ++++ level_3/fake/c/private-build.c | 105 +++++++++++++++++++-- level_3/fake/c/private-build.h | 7 +- level_3/fake/data/build/settings | 1 + level_3/firewall/data/build/settings | 1 + level_3/fss_basic_list_read/data/build/settings | 1 + level_3/fss_basic_list_write/data/build/settings | 1 + level_3/fss_basic_read/data/build/settings | 1 + level_3/fss_basic_write/data/build/settings | 1 + level_3/fss_extended_list_read/data/build/settings | 1 + level_3/fss_extended_read/data/build/settings | 1 + level_3/fss_extended_write/data/build/settings | 1 + level_3/fss_status_code/data/build/settings | 1 + level_3/init/data/build/settings | 1 + level_3/status_code/data/build/settings | 1 + 56 files changed, 203 insertions(+), 28 deletions(-) diff --git a/build/level_0/settings b/build/level_0/settings index f2a9226..5775fb8 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -5,6 +5,7 @@ project_name fll_0 version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/build/level_1/settings b/build/level_1/settings index 60d19b8..dfa8ba3 100644 --- a/build/level_1/settings +++ b/build/level_1/settings @@ -5,6 +5,7 @@ project_name fll_1 version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/build/level_2/settings b/build/level_2/settings index 9dd1c5f..616e707 100644 --- a/build/level_2/settings +++ b/build/level_2/settings @@ -5,6 +5,7 @@ project_name fll_2 version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/build/monolithic/settings b/build/monolithic/settings index 523c984..8ce3157 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -5,6 +5,7 @@ project_name fll version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/build/scripts/generate.sh b/build/scripts/generate.sh index 5532297..9dee8ea 100644 --- a/build/scripts/generate.sh +++ b/build/scripts/generate.sh @@ -363,22 +363,23 @@ generate_id(){ "version_major") echo -n 37;; "version_micro") echo -n 38;; "version_minor") echo -n 39;; - - "build_libraries-$mode") echo -n 40;; - "build_sources_headers-$mode") echo -n 41;; - "build_sources_library-$mode") echo -n 42;; - "build_sources_program-$mode") echo -n 43;; - "build_sources_setting-$mode") echo -n 44;; - "build_sources_script-$mode") echo -n 45;; - "defines_all-$mode") echo -n 46;; - "defines_shared-$mode") echo -n 47;; - "defines_static-$mode") echo -n 48;; - "environment-$mode") echo -n 49;; - "flags_all-$mode") echo -n 50;; - "flags_library-$mode") echo -n 51;; - "flags_program-$mode") echo -n 52;; - "flags_shared-$mode") echo -n 53;; - "flags_static-$mode") echo -n 54;; + "version_target") echo -n 40;; + + "build_libraries-$mode") echo -n 41;; + "build_sources_headers-$mode") echo -n 42;; + "build_sources_library-$mode") echo -n 43;; + "build_sources_program-$mode") echo -n 44;; + "build_sources_setting-$mode") echo -n 45;; + "build_sources_script-$mode") echo -n 46;; + "defines_all-$mode") echo -n 47;; + "defines_shared-$mode") echo -n 48;; + "defines_static-$mode") echo -n 49;; + "environment-$mode") echo -n 50;; + "flags_all-$mode") echo -n 51;; + "flags_library-$mode") echo -n 52;; + "flags_program-$mode") echo -n 53;; + "flags_shared-$mode") echo -n 54;; + "flags_static-$mode") echo -n 55;; esac } @@ -440,6 +441,7 @@ generate_operation_build(){ local major=${variables[$(generate_id version_major)]} local minor=${variables[$(generate_id version_minor)]} local micro=${variables[$(generate_id version_micro)]} + local target=${variables[$(generate_id version_target)]} local compiler=${variables[$(generate_id build_compiler)]} local linker=${variables[$(generate_id build_linker)]} local arguments_include="-I${path_build}includes" @@ -468,10 +470,23 @@ generate_operation_build(){ local flags_program=${variables[$(generate_id flags_program)]} local i= local n= + local version= local alt=$1 local directory= local path_headers=${variables[$(generate_id path_headers)]} + if [[ $target == "" ]] ; then + target="major" + fi + + if [[ $target == "major" ]] ; then + version="$major" + elif [[ $target == "minor" ]] ; then + version="${major}.$minor" + elif [[ $target == "micro" ]] ; then + version="${major}.${minor}.$micro" + fi + if [[ $sources_library == "" ]] ; then sources_library=${variables[$(generate_id build_sources_library-$mode)]} else @@ -709,8 +724,8 @@ generate_operation_build(){ sources="$sources$path_c$i " done - echo $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library - $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library || failure=1 + echo $compiler $sources -shared -Wl,-soname,lib$name.so.$version -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library + $compiler $sources -shared -Wl,-soname,lib$name.so.$version -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library || failure=1 if [[ $failure == "" ]] ; then ln -vsf lib$name.so.$major.$minor.$micro ${path_build}libraries/shared/lib$name.so.$major || failure=1 diff --git a/level_0/f_color/data/build/settings b/level_0/f_color/data/build/settings index 2ad6a7d..ab2504b 100644 --- a/level_0/f_color/data/build/settings +++ b/level_0/f_color/data/build/settings @@ -5,6 +5,7 @@ project_name f_color version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_console/data/build/settings b/level_0/f_console/data/build/settings index dc78db2..e4f37c0 100644 --- a/level_0/f_console/data/build/settings +++ b/level_0/f_console/data/build/settings @@ -5,6 +5,7 @@ project_name f_console version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_conversion/data/build/settings b/level_0/f_conversion/data/build/settings index 8d115d7..0a82958 100644 --- a/level_0/f_conversion/data/build/settings +++ b/level_0/f_conversion/data/build/settings @@ -5,6 +5,7 @@ project_name f_conversion version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_directory/data/build/settings b/level_0/f_directory/data/build/settings index ab0d948..6b80214 100644 --- a/level_0/f_directory/data/build/settings +++ b/level_0/f_directory/data/build/settings @@ -5,6 +5,7 @@ project_name f_directory version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_environment/data/build/settings b/level_0/f_environment/data/build/settings index 9bb72ca..7d93e65 100644 --- a/level_0/f_environment/data/build/settings +++ b/level_0/f_environment/data/build/settings @@ -5,6 +5,7 @@ project_name f_environment version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_file/data/build/settings b/level_0/f_file/data/build/settings index b8e027b..94200b8 100644 --- a/level_0/f_file/data/build/settings +++ b/level_0/f_file/data/build/settings @@ -5,6 +5,7 @@ project_name f_file version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index ad2395a..af05559 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -5,6 +5,7 @@ project_name f_fss version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_memory/data/build/settings b/level_0/f_memory/data/build/settings index 38af880..a39b499 100644 --- a/level_0/f_memory/data/build/settings +++ b/level_0/f_memory/data/build/settings @@ -5,6 +5,7 @@ project_name f_memory version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_path/data/build/settings b/level_0/f_path/data/build/settings index cd750d8..96a2991 100644 --- a/level_0/f_path/data/build/settings +++ b/level_0/f_path/data/build/settings @@ -5,6 +5,7 @@ project_name f_path version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_pipe/data/build/settings b/level_0/f_pipe/data/build/settings index a7d3968..8634d1d 100644 --- a/level_0/f_pipe/data/build/settings +++ b/level_0/f_pipe/data/build/settings @@ -5,6 +5,7 @@ project_name f_pipe version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_print/data/build/settings b/level_0/f_print/data/build/settings index 37f3c01..1268b34 100644 --- a/level_0/f_print/data/build/settings +++ b/level_0/f_print/data/build/settings @@ -5,6 +5,7 @@ project_name f_print version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_serialized/data/build/settings b/level_0/f_serialized/data/build/settings index 13005ab..3e0a939 100644 --- a/level_0/f_serialized/data/build/settings +++ b/level_0/f_serialized/data/build/settings @@ -5,6 +5,7 @@ project_name f_serialized version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_socket/data/build/settings b/level_0/f_socket/data/build/settings index 2ef51a4..322b37b 100644 --- a/level_0/f_socket/data/build/settings +++ b/level_0/f_socket/data/build/settings @@ -5,6 +5,7 @@ project_name f_socket version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_status/data/build/settings b/level_0/f_status/data/build/settings index 98a50df..5a5651b 100644 --- a/level_0/f_status/data/build/settings +++ b/level_0/f_status/data/build/settings @@ -5,6 +5,7 @@ project_name f_status version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_string/data/build/settings b/level_0/f_string/data/build/settings index ca4e69d..a9c3036 100644 --- a/level_0/f_string/data/build/settings +++ b/level_0/f_string/data/build/settings @@ -5,6 +5,7 @@ project_name f_string version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_type/data/build/settings b/level_0/f_type/data/build/settings index d82d7d7..a21a474 100644 --- a/level_0/f_type/data/build/settings +++ b/level_0/f_type/data/build/settings @@ -5,6 +5,7 @@ project_name f_type version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_0/f_utf/data/build/settings b/level_0/f_utf/data/build/settings index 9b85ffd..f969ed2 100644 --- a/level_0/f_utf/data/build/settings +++ b/level_0/f_utf/data/build/settings @@ -5,6 +5,7 @@ project_name f_utf version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_color/data/build/settings b/level_1/fl_color/data/build/settings index a68c63c..be3e02d 100644 --- a/level_1/fl_color/data/build/settings +++ b/level_1/fl_color/data/build/settings @@ -5,6 +5,7 @@ project_name fl_color version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_console/data/build/settings b/level_1/fl_console/data/build/settings index 985d02b..95c0b61 100644 --- a/level_1/fl_console/data/build/settings +++ b/level_1/fl_console/data/build/settings @@ -5,6 +5,7 @@ project_name fl_console version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_directory/data/build/settings b/level_1/fl_directory/data/build/settings index cd1e0d6..6857fa6 100644 --- a/level_1/fl_directory/data/build/settings +++ b/level_1/fl_directory/data/build/settings @@ -5,6 +5,7 @@ project_name fl_directory version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_file/data/build/settings b/level_1/fl_file/data/build/settings index 5e0e557..e50d548 100644 --- a/level_1/fl_file/data/build/settings +++ b/level_1/fl_file/data/build/settings @@ -5,6 +5,7 @@ project_name fl_file version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_fss/data/build/settings b/level_1/fl_fss/data/build/settings index 217e991..b43c037 100644 --- a/level_1/fl_fss/data/build/settings +++ b/level_1/fl_fss/data/build/settings @@ -5,6 +5,7 @@ project_name fl_fss version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_print/data/build/settings b/level_1/fl_print/data/build/settings index d0d2b82..67f9bb3 100644 --- a/level_1/fl_print/data/build/settings +++ b/level_1/fl_print/data/build/settings @@ -5,6 +5,7 @@ project_name fl_print version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_serialized/data/build/settings b/level_1/fl_serialized/data/build/settings index 33e65f6..1f37069 100644 --- a/level_1/fl_serialized/data/build/settings +++ b/level_1/fl_serialized/data/build/settings @@ -5,6 +5,7 @@ project_name fl_serialized version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_socket/data/build/settings b/level_1/fl_socket/data/build/settings index c7c0b95..5469e9c 100644 --- a/level_1/fl_socket/data/build/settings +++ b/level_1/fl_socket/data/build/settings @@ -5,6 +5,7 @@ project_name fl_socket version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_status/data/build/settings b/level_1/fl_status/data/build/settings index dc3d7f2..2750fa5 100644 --- a/level_1/fl_status/data/build/settings +++ b/level_1/fl_status/data/build/settings @@ -5,6 +5,7 @@ project_name fl_status version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_string/data/build/settings b/level_1/fl_string/data/build/settings index 08c4e4d..97545ab 100644 --- a/level_1/fl_string/data/build/settings +++ b/level_1/fl_string/data/build/settings @@ -5,6 +5,7 @@ project_name fl_string version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_utf/data/build/settings b/level_1/fl_utf/data/build/settings index 133022c..2aad224 100644 --- a/level_1/fl_utf/data/build/settings +++ b/level_1/fl_utf/data/build/settings @@ -5,6 +5,7 @@ project_name fl_utf version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_1/fl_utf_file/data/build/settings b/level_1/fl_utf_file/data/build/settings index 468ff07..07c15cf 100644 --- a/level_1/fl_utf_file/data/build/settings +++ b/level_1/fl_utf_file/data/build/settings @@ -5,6 +5,7 @@ project_name fl_utf_file version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_directory/data/build/settings b/level_2/fll_directory/data/build/settings index c5acc8d..a68f9a8 100644 --- a/level_2/fll_directory/data/build/settings +++ b/level_2/fll_directory/data/build/settings @@ -5,6 +5,7 @@ project_name fll_directory version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_execute/data/build/settings b/level_2/fll_execute/data/build/settings index ebddf1d..c90caf6 100644 --- a/level_2/fll_execute/data/build/settings +++ b/level_2/fll_execute/data/build/settings @@ -5,6 +5,7 @@ project_name fll_execute version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_file/data/build/settings b/level_2/fll_file/data/build/settings index f1a4201..9a2e30f 100644 --- a/level_2/fll_file/data/build/settings +++ b/level_2/fll_file/data/build/settings @@ -5,6 +5,7 @@ project_name fll_file version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_fss/data/build/settings b/level_2/fll_fss/data/build/settings index 5cb307a..e239182 100644 --- a/level_2/fll_fss/data/build/settings +++ b/level_2/fll_fss/data/build/settings @@ -5,6 +5,7 @@ project_name fll_fss version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_program/data/build/settings b/level_2/fll_program/data/build/settings index be8cf82..5b6d67d 100644 --- a/level_2/fll_program/data/build/settings +++ b/level_2/fll_program/data/build/settings @@ -5,6 +5,7 @@ project_name fll_program version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_2/fll_status/data/build/settings b/level_2/fll_status/data/build/settings index 93f11c0..76133aa 100644 --- a/level_2/fll_status/data/build/settings +++ b/level_2/fll_status/data/build/settings @@ -5,6 +5,7 @@ project_name fll_status version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/byte_dump/data/build/settings b/level_3/byte_dump/data/build/settings index 9064079..e12a04f 100644 --- a/level_3/byte_dump/data/build/settings +++ b/level_3/byte_dump/data/build/settings @@ -5,6 +5,7 @@ project_name byte_dump version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 3668ecd..023aa11 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -198,6 +198,22 @@ extern "C" { #define fake_build_language_cpp_length 3 #endif // _di_fake_build_language_ +#ifndef _di_fake_build_version_ + enum { + fake_build_version_type_major = 1, + fake_build_version_type_micro, + fake_build_version_type_minor, + }; + + #define fake_build_version_major "major" + #define fake_build_version_micro "micro" + #define fake_build_version_minor "minor" + + #define fake_build_version_major_length 5 + #define fake_build_version_micro_length 5 + #define fake_build_version_minor_length 5 +#endif // _di_fake_build_version_ + #ifndef _di_fake_defines_ enum { fake_operation_build = 1, diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 5823c14..bb01bca 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -673,13 +673,31 @@ extern "C" { parameter_file_path[parameter_file_path_length] = 0; - f_string_length parameter_linker_length = fake_build_parameter_library_shared_prefix_length + parameter_file_name_micro_length; + f_string_length parameter_linker_length = fake_build_parameter_library_shared_prefix_length; + + if (data_build.setting.version_target == fake_build_version_type_major) { + parameter_linker_length += parameter_file_name_major_length; + } + else if (data_build.setting.version_target == fake_build_version_type_minor) { + parameter_linker_length += parameter_file_name_minor_length; + } + else if (data_build.setting.version_target == fake_build_version_type_micro) { + parameter_linker_length += parameter_file_name_micro_length; + } char parameter_linker[parameter_linker_length + 1]; memcpy(parameter_linker, fake_build_parameter_library_shared_prefix, fake_build_parameter_library_shared_prefix_length); - memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_length, parameter_file_name_micro, parameter_file_name_micro_length); + if (data_build.setting.version_target == fake_build_version_type_major) { + memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_length, parameter_file_name_major, parameter_file_name_major_length); + } + else if (data_build.setting.version_target == fake_build_version_type_minor) { + memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_length, parameter_file_name_minor, parameter_file_name_minor_length); + } + else if (data_build.setting.version_target == fake_build_version_type_micro) { + memcpy(parameter_linker + fake_build_parameter_library_shared_prefix_length, parameter_file_name_micro, parameter_file_name_micro_length); + } parameter_linker[parameter_linker_length] = 0; @@ -1168,6 +1186,7 @@ extern "C" { fake_build_setting_name_version_major, fake_build_setting_name_version_micro, fake_build_setting_name_version_minor, + fake_build_setting_name_version_target, }; const f_string_length settings_length[] = { @@ -1212,6 +1231,7 @@ extern "C" { fake_build_setting_name_version_major_length, fake_build_setting_name_version_micro_length, fake_build_setting_name_version_minor_length, + fake_build_setting_name_version_target_length, }; f_string_dynamics build_compiler = f_string_dynamics_initialize; @@ -1238,6 +1258,7 @@ extern "C" { f_string_dynamics version_major = f_string_dynamics_initialize; f_string_dynamics version_micro = f_string_dynamics_initialize; f_string_dynamics version_minor = f_string_dynamics_initialize; + f_string_dynamics version_target = f_string_dynamics_initialize; f_string_dynamics *settings_value[] = { &build_compiler, @@ -1281,6 +1302,7 @@ extern "C" { &version_major, &version_micro, &version_minor, + &version_target, }; f_string function = "fll_fss_snatch_apart"; @@ -1380,7 +1402,9 @@ extern "C" { } else { const f_string settings_single_name[] = { + fake_build_setting_name_build_compiler, fake_build_setting_name_build_language, + fake_build_setting_name_build_linker, fake_build_setting_name_build_script, fake_build_setting_name_build_shared, fake_build_setting_name_build_static, @@ -1402,6 +1426,7 @@ extern "C" { fake_build_setting_name_version_major, fake_build_setting_name_version_micro, fake_build_setting_name_version_minor, + fake_build_setting_name_version_target, }; const f_string_statics *settings_single_source[] = { @@ -1429,11 +1454,7 @@ extern "C" { &version_major, &version_micro, &version_minor, - }; - - uint8_t *settings_single_language[] = { - 0, - &setting->build_language, + &version_target, }; bool *settings_single_bool[] = { @@ -1487,7 +1508,40 @@ extern "C" { &setting->version_minor, }; - // 1 = "yes" or "no", 2 = path/, 3 = literal, 4 = "bash", "c", or "c++". + uint8_t *settings_single_language[] = { + 0, + &setting->build_language, + }; + + uint8_t *settings_single_version[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + &setting->version_target, + }; + + // 1 = "yes" or "no", 2 = path/, 3 = literal, 4 = "bash", "c", or "c++", 5 = "major", "minor", or "micro". uint8_t settings_single_type[] = { 3, 4, @@ -1513,9 +1567,10 @@ extern "C" { 3, 3, 3, + 5, }; - for (f_array_length i = 0; i < 24; i++) { + for (f_array_length i = 0; i < 25; i++) { if (settings_single_source[i]->used == 0) continue; if (settings_single_source[i]->used > 1) { @@ -1588,6 +1643,37 @@ extern "C" { } } } + else if (settings_single_type[i] == 5) { + if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_major, settings_single_source[i]->array[0].used, fake_build_version_major_length) == F_equal_to) { + *settings_single_version[i] = fake_build_version_type_major; + } + else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_micro, settings_single_source[i]->array[0].used, fake_build_version_micro_length) == F_equal_to) { + *settings_single_version[i] = fake_build_version_type_micro; + } + else if (fl_string_compare_trim(settings_single_source[i]->array[0].string, fake_build_version_minor, settings_single_source[i]->array[0].used, fake_build_version_minor_length) == F_equal_to) { + *settings_single_version[i] = fake_build_version_type_minor; + } + else { + *settings_single_version[i] = fake_build_version_type_major; + + if (data.verbosity != fake_verbosity_quiet) { + fprintf(f_type_warning, "%c", f_string_eol[0]); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "WARNING: the setting '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", settings_single_name[i]); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' in the file '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", data.file_data_build_settings.string); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "' may only be one of '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", fake_build_version_major); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "', '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", fake_build_version_minor); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "', or '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", fake_build_version_micro); + fl_color_print(f_type_warning, data.context.warning, data.context.reset, "', defaulting to '"); + fl_color_print(f_type_warning, data.context.notable, data.context.reset, "%s", fake_build_version_major); + fl_color_print_line(f_type_warning, data.context.warning, data.context.reset, "'."); + } + } + } else { *status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); if (F_status_is_error(*status)) { @@ -1636,6 +1722,7 @@ extern "C" { f_macro_string_dynamics_delete_simple(version_major); f_macro_string_dynamics_delete_simple(version_micro); f_macro_string_dynamics_delete_simple(version_minor); + f_macro_string_dynamics_delete_simple(version_target); } f_macro_fss_objects_delete_simple(objects); diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index d7c1c5c..2e32f9f 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -32,6 +32,8 @@ extern "C" { typedef struct { uint8_t build_language; + uint8_t version_target; + bool build_script; bool build_shared; bool build_static; @@ -79,6 +81,7 @@ extern "C" { #define fake_build_setting_initialize { \ 0, \ + 0, \ F_true, \ F_true, \ F_true, \ @@ -198,6 +201,7 @@ extern "C" { #define fake_build_setting_name_version_major "version_major" #define fake_build_setting_name_version_micro "version_micro" #define fake_build_setting_name_version_minor "version_minor" + #define fake_build_setting_name_version_target "version_target" #define fake_build_setting_name_build_compiler_length 14 #define fake_build_setting_name_build_language_length 14 @@ -240,8 +244,9 @@ extern "C" { #define fake_build_setting_name_version_major_length 13 #define fake_build_setting_name_version_micro_length 13 #define fake_build_setting_name_version_minor_length 13 + #define fake_build_setting_name_version_target_length 14 - #define fake_build_setting_total 41 + #define fake_build_setting_total 42 #define fake_build_setting_bool_yes "yes" #define fake_build_setting_bool_no "no" diff --git a/level_3/fake/data/build/settings b/level_3/fake/data/build/settings index de0a5c4..c5451f5 100644 --- a/level_3/fake/data/build/settings +++ b/level_3/fake/data/build/settings @@ -5,6 +5,7 @@ project_name fake version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index 186641e..0ae42ee 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -5,6 +5,7 @@ project_name firewall version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_basic_list_read/data/build/settings b/level_3/fss_basic_list_read/data/build/settings index 48cd9dc..574404b 100644 --- a/level_3/fss_basic_list_read/data/build/settings +++ b/level_3/fss_basic_list_read/data/build/settings @@ -5,6 +5,7 @@ project_name fss_basic_list_read version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings index f9e6b5b..0c86ee1 100644 --- a/level_3/fss_basic_list_write/data/build/settings +++ b/level_3/fss_basic_list_write/data/build/settings @@ -5,6 +5,7 @@ project_name fss_basic_list_write version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_basic_read/data/build/settings b/level_3/fss_basic_read/data/build/settings index cd509e5..97a3299 100644 --- a/level_3/fss_basic_read/data/build/settings +++ b/level_3/fss_basic_read/data/build/settings @@ -5,6 +5,7 @@ project_name fss_basic_read version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings index bd745fa..9ecc6b3 100644 --- a/level_3/fss_basic_write/data/build/settings +++ b/level_3/fss_basic_write/data/build/settings @@ -5,6 +5,7 @@ project_name fss_basic_write version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_extended_list_read/data/build/settings b/level_3/fss_extended_list_read/data/build/settings index bae1410..14e43ce 100644 --- a/level_3/fss_extended_list_read/data/build/settings +++ b/level_3/fss_extended_list_read/data/build/settings @@ -5,6 +5,7 @@ project_name fss_extended_list_read version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_extended_read/data/build/settings b/level_3/fss_extended_read/data/build/settings index 74d1a46..0fe2271 100644 --- a/level_3/fss_extended_read/data/build/settings +++ b/level_3/fss_extended_read/data/build/settings @@ -5,6 +5,7 @@ project_name fss_extended_read version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings index 3fad126..1f00836 100644 --- a/level_3/fss_extended_write/data/build/settings +++ b/level_3/fss_extended_write/data/build/settings @@ -5,6 +5,7 @@ project_name fss_extended_write version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/fss_status_code/data/build/settings b/level_3/fss_status_code/data/build/settings index 723b057..dd72000 100644 --- a/level_3/fss_status_code/data/build/settings +++ b/level_3/fss_status_code/data/build/settings @@ -5,6 +5,7 @@ project_name fss_status_code version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/init/data/build/settings b/level_3/init/data/build/settings index f679939..8e1b0d2 100644 --- a/level_3/init/data/build/settings +++ b/level_3/init/data/build/settings @@ -5,6 +5,7 @@ project_name init version_major 0 version_minor 5 version_micro 0 +version_target major environment diff --git a/level_3/status_code/data/build/settings b/level_3/status_code/data/build/settings index 44ec947..45292a6 100644 --- a/level_3/status_code/data/build/settings +++ b/level_3/status_code/data/build/settings @@ -5,6 +5,7 @@ project_name status_code version_major 0 version_minor 5 version_micro 0 +version_target major environment -- 1.8.3.1