From 9d2b6b5becdda9f0bab9f7acc8d862c4303494a1 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 4 Sep 2020 21:10:47 -0500 Subject: [PATCH] Update: featureless make should not autp-prepend "-D". Having this does simplify the configuration. The downside is that it limits the flexibility and requires compiler-specific code to be added and potentially added. Removing the auto-prepend "-D" will reduce the amount of language or compiler specific code in featureless make. If another C compiler exists but uses something other than "-D" for defines, then only the settings file need be updated. --- build/scripts/bootstrap.sh | 6 +-- level_3/fake/c/private-build.c | 44 ++-------------------- level_3/fake/c/private-build.h | 5 --- level_3/fake/data/build/settings-example-bzip2 | 3 +- .../fake/data/build/settings-example-bzip2recover | 3 +- level_3/fake/documents/settings.txt | 3 -- level_3/fake/specifications/defines.txt | 4 -- level_3/firewall/data/build/settings | 2 +- 8 files changed, 10 insertions(+), 60 deletions(-) diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index 931e718..613b266 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -667,21 +667,21 @@ bootstrap_operation_build() { if [[ $defines != "" ]] ; then flags_all="$flags_all " for i in $defines ; do - flags_all="${flags_all}-D$i " + flags_all="${flags_all}$i " done fi if [[ $defines_shared != "" ]] ; then flags_shared="$flags_shared " for i in $defines_shared ; do - flags_shared="${flags_shared}-D$i " + flags_shared="${flags_shared}$i " done fi if [[ $defines_static != "" ]] ; then flags_static="$flags_static " for i in $defines_static ; do - flags_static="${flags_static}-D$i " + flags_static="${flags_static}$i " done fi diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index d8bd9e3..67b518d 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -125,16 +125,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data.define.used && F_status_is_fine(*status); i++) { - length = fake_build_parameter_define_prefix_length + data.define.array[i].used; - - char string[length + 1]; - - memcpy(string, fake_build_parameter_define_prefix, fake_build_parameter_define_prefix_length); - memcpy(string + fake_build_parameter_define_prefix_length, data.define.array[i].string, data.define.array[i].used); - - string[length] = 0; - - *status = fll_execute_arguments_add(string, length, arguments); + *status = fll_execute_arguments_add(data.define.array[i].string, data.define.array[i].used, arguments); if (F_status_is_error(*status)) break; } // for } @@ -143,46 +134,19 @@ extern "C" { f_array_length_t i = 0; for (; i < data_build.setting.defines_all.used && F_status_is_fine(*status); i++) { - length = fake_build_parameter_define_prefix_length + data_build.setting.defines_all.array[i].used; - - char string[length + 1]; - - memcpy(string, fake_build_parameter_define_prefix, fake_build_parameter_define_prefix_length); - memcpy(string + fake_build_parameter_define_prefix_length, data_build.setting.defines_all.array[i].string, data_build.setting.defines_all.array[i].used); - - string[length] = 0; - - *status = fll_execute_arguments_add(string, length, arguments); + *status = fll_execute_arguments_add(data_build.setting.defines_all.array[i].string, data_build.setting.defines_all.array[i].used, arguments); if (F_status_is_error(*status)) break; } // for if (is_shared) { for (i = 0; i < data_build.setting.defines_shared.used && F_status_is_fine(*status); i++) { - length = fake_build_parameter_define_prefix_length + data_build.setting.defines_shared.array[i].used; - - char string[length + 1]; - - memcpy(string, fake_build_parameter_define_prefix, fake_build_parameter_define_prefix_length); - memcpy(string + fake_build_parameter_define_prefix_length, data_build.setting.defines_shared.array[i].string, data_build.setting.defines_shared.array[i].used); - - string[length] = 0; - - *status = fll_execute_arguments_add(string, length, arguments); + *status = fll_execute_arguments_add(data_build.setting.defines_shared.array[i].string, data_build.setting.defines_shared.array[i].used, arguments); if (F_status_is_error(*status)) break; } // for } else { for (i = 0; i < data_build.setting.defines_static.used && F_status_is_fine(*status); i++) { - length = fake_build_parameter_define_prefix_length + data_build.setting.defines_static.array[i].used; - - char string[length + 1]; - - memcpy(string, fake_build_parameter_define_prefix, fake_build_parameter_define_prefix_length); - memcpy(string + fake_build_parameter_define_prefix_length, data_build.setting.defines_static.array[i].string, data_build.setting.defines_static.array[i].used); - - string[length] = 0; - - *status = fll_execute_arguments_add(string, length, arguments); + *status = fll_execute_arguments_add(data_build.setting.defines_static.array[i].string, data_build.setting.defines_static.array[i].used, arguments); if (F_status_is_error(*status)) break; } // for } diff --git a/level_3/fake/c/private-build.h b/level_3/fake/c/private-build.h index d4e8e53..db78e22 100644 --- a/level_3/fake/c/private-build.h +++ b/level_3/fake/c/private-build.h @@ -328,11 +328,6 @@ extern "C" { #endif // _di_fake_build_data_t_ #ifndef _di_fake_build_parameter_ - - #define fake_build_parameter_define_prefix "-D" - - #define fake_build_parameter_define_prefix_length 2 - #define fake_build_parameter_library_include "-I" #define fake_build_parameter_library_link_file "-l" #define fake_build_parameter_library_link_path "-L" diff --git a/level_3/fake/data/build/settings-example-bzip2 b/level_3/fake/data/build/settings-example-bzip2 index 92ff391..d11ca78 100644 --- a/level_3/fake/data/build/settings-example-bzip2 +++ b/level_3/fake/data/build/settings-example-bzip2 @@ -4,7 +4,6 @@ # 1) need to be able to build -m bzip2recover without libbzip2.a. # 2) need to provide a way to designate path prefixes (instead of just hardcoded sources/c/, etc... # 3) need to be able to build shared program without library (add a 'build_library' setting). -# 4) need to remove the auto-appending of the -D in the defines. project_name bzip2 @@ -46,7 +45,7 @@ search_exclusive yes search_shared yes search_static yes -defines_all _FILE_OFFSET_BITS=64 +defines_all -D_FILE_OFFSET_BITS=64 defines_static defines_shared diff --git a/level_3/fake/data/build/settings-example-bzip2recover b/level_3/fake/data/build/settings-example-bzip2recover index 97914c0..95e831e 100644 --- a/level_3/fake/data/build/settings-example-bzip2recover +++ b/level_3/fake/data/build/settings-example-bzip2recover @@ -4,7 +4,6 @@ # 1) need to be able to build -m bzip2recover without libbzip2.a. # 2) need to provide a way to designate path prefixes (instead of just hardcoded sources/c/, etc... # 3) need to be able to build shared program without library (add a 'build_library' setting). -# 4) need to remove the auto-appending of the -D in the defines. project_name bzip2recover @@ -46,7 +45,7 @@ search_exclusive yes search_shared yes search_static yes -defines_all _FILE_OFFSET_BITS=64 +defines_all -D_FILE_OFFSET_BITS=64 defines_static defines_shared diff --git a/level_3/fake/documents/settings.txt b/level_3/fake/documents/settings.txt index eee74d8..a232b32 100644 --- a/level_3/fake/documents/settings.txt +++ b/level_3/fake/documents/settings.txt @@ -68,19 +68,16 @@ Settings Documentation: defines_all\: A collection of macro names. These will be appended to the compiler for compiled languages such as C and C++. - These will automatically have "-D" prepended to them. These are applied to both shared and static builds. defines_shared\: A collection of macro names. These will be appended to the compiler for compiled languages such as C and C++. - These will automatically have "-D" prepended to them. These are applied to only shared builds. defines_static\: A collection of macro names. These will be appended to the compiler for compiled languages such as C and C++. - These will automatically have "-D" prepended to them. These are applied to only static builds. environment\: diff --git a/level_3/fake/specifications/defines.txt b/level_3/fake/specifications/defines.txt index 08b1890..d5bfc78 100644 --- a/level_3/fake/specifications/defines.txt +++ b/level_3/fake/specifications/defines.txt @@ -9,7 +9,3 @@ Defines Specification: The Object name has further restrictions than FSS-0000 requires. These restrictions are that the Object must only evaluate to a valid C/C++ macro name. This is essentially means only Word characters. - - It is recommended that each define begin and end with an underscore. - The Featureless Make program will convert the define as follows when compiling\: - - Object name = "_en_my_macro_" will become "-D_en_my_macro_". diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index 96f2a2b..7755289 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -43,7 +43,7 @@ search_exclusive yes search_shared yes search_static yes -defines_all _en_firewall_debug_ +defines_all -D_en_firewall_debug_ defines_static defines_shared -- 1.8.3.1