From: Kevin Day Date: Thu, 9 Oct 2014 03:15:01 +0000 (-0500) Subject: Feature: add support for defining the linker program via build_linker= setting X-Git-Tag: 0.4.2~21 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=f42bd56415a7c96c89a031939e482cb42c8c3fd9;p=fll Feature: add support for defining the linker program via build_linker= setting --- diff --git a/build/scripts/generate.sh b/build/scripts/generate.sh index 66be680..00a7ec5 100644 --- a/build/scripts/generate.sh +++ b/build/scripts/generate.sh @@ -198,9 +198,10 @@ generate_id(){ "version_minor") echo -n 3;; "version_micro") echo -n 4;; "build_compiler") echo -n 5;; - "build_libraries") echo -n 6;; - "build_sources_library") echo -n 7;; - "build_sources_program") echo -n 8;; + "build_linker") echo -n 6;; + "build_libraries") echo -n 7;; + "build_sources_library") echo -n 8;; + "build_sources_program") echo -n 9;; "build_sources_headers") echo -n 10;; "build_sources_settings") echo -n 11;; "build_shared") echo -n 12;; @@ -229,7 +230,7 @@ generate_load_settings(){ exit $failure fi - for i in project_name project_level version_major version_minor version_micro build_compiler build_libraries build_sources_library build_sources_program build_sources_headers build_sources_settings build_shared flags_all flags_shared flags_static flags_library flags_program ; do + for i in project_name project_level version_major version_minor version_micro build_compiler build_linker build_libraries build_sources_library build_sources_program build_sources_headers build_sources_settings build_shared flags_all flags_shared flags_static flags_library flags_program ; do variables[$(generate_id $i)]=$(grep -s -o "^[[:space:]]*$i\>.*$" $settings_file | sed -e "s|^[[:space:]]*$i\>||" -e 's|^[[:space:]]*||') done } @@ -272,6 +273,7 @@ generate_operation_build(){ local minor=${variables[$(generate_id version_minor)]} local micro=${variables[$(generate_id version_micro)]} local compiler=${variables[$(generate_id build_compiler)]} + local linker=${variables[$(generate_id build_linker)]} local arguments="-I${path_build}includes -L${path_build}libraries ${variables[$(generate_id flags_all)]} ${variables[$(generate_id build_libraries)]}" local shared=${variables[$(generate_id build_shared)]} local sources_library=${variables[$(generate_id build_sources_library)]} @@ -322,10 +324,22 @@ generate_operation_build(){ sources= sources_alt= if [[ $alt == "alt" ]] ; then + if [[ $sources_library != "" ]] ; then + for i in $sources_library ; do + sources_alt="$sources_alt$path_c$i " + done + fi + for i in $sources_program ; do sources_alt="$sources_alt$path_c$i " done else + if [[ $sources_library != "" ]] ; then + for i in $sources_library ; do + sources="$sources$path_c$i " + done + fi + for i in $sources_program ; do sources="$sources$path_c$i " done @@ -340,27 +354,57 @@ generate_operation_build(){ if [[ $sources_library != "" ]] ; then if [[ $alt == "alt" ]] ; then for i in $sources_library ; do - sources_alt="$sources_alt$path_c$i " + sources="$sources${path_build}libraries/$i.o " + sources_alt="$sources_alt$sources " + + echo $compiler $path_c$i $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} -c -static -o ${path_build}libraries/$i.o + $compiler $path_c$i $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} -c -static -o ${path_build}libraries/$i.o || failure=1 + + if [[ $failure == "1" ]] ; then + break; + fi done else for i in $sources_library ; do - sources="$sources$path_c$i " + sources="$sources${path_build}libraries/$i.o " + sources_alt="$sources_alt$sources " + + echo $compiler $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} $path_c$i -c -static -o ${path_build}libraries/$i.o + $compiler $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} $path_c$i -c -static -o ${path_build}libraries/$i.o || failure=1 + + if [[ $failure == "1" ]] ; then + break; + fi done fi - echo $compiler $sources_alt $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} $sources -static -o ${path_build}libraries/lib$name.a - $compiler $sources_alt $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} $sources -static -o ${path_build}libraries/lib$name.a || failure=1 + if [[ $failure == "" ]] ; then + echo $linker rcs ${path_build}libraries/lib$name.a $sources_alt + $linker rcs ${path_build}libraries/lib$name.a $sources_alt || failure=1 + fi fi if [[ $failure == "" && $sources_program != "" ]] ; then sources= sources_alt= if [[ $alt == "alt" ]] ; then + if [[ $sources_library != "" ]] ; then + for i in $sources_library ; do + sources_alt="$sources_alt$path_c$i " + done + fi + for i in $sources_program ; do sources_alt="$sources_alt$path_c$i " done else - for i in $sources_library ; do + if [[ $sources_library != "" ]] ; then + for i in $sources_library ; do + sources="$sources$path_c$i " + done + fi + + for i in $sources_program ; do sources="$sources$path_c$i " done fi diff --git a/level_0/f_colors/data/build/settings b/level_0/f_colors/data/build/settings index eea7635..199bfed 100644 --- a/level_0/f_colors/data/build/settings +++ b/level_0/f_colors/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_0/f_console/data/build/settings b/level_0/f_console/data/build/settings index 6effd4b..f12247e 100644 --- a/level_0/f_console/data/build/settings +++ b/level_0/f_console/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library console.c build_sources_program diff --git a/level_0/f_conversion/data/build/settings b/level_0/f_conversion/data/build/settings index 79c2da3..a3feb36 100644 --- a/level_0/f_conversion/data/build/settings +++ b/level_0/f_conversion/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library conversion.c build_sources_program diff --git a/level_0/f_errors/data/build/settings b/level_0/f_errors/data/build/settings index f8af285..cd8bbf9 100644 --- a/level_0/f_errors/data/build/settings +++ b/level_0/f_errors/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_0/f_file/data/build/settings b/level_0/f_file/data/build/settings index 7eb32bf..6c3d504 100644 --- a/level_0/f_file/data/build/settings +++ b/level_0/f_file/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library file.c build_sources_program diff --git a/level_0/f_fss/data/build/settings b/level_0/f_fss/data/build/settings index f716774..cac2f91 100644 --- a/level_0/f_fss/data/build/settings +++ b/level_0/f_fss/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_0/f_memory/data/build/settings b/level_0/f_memory/data/build/settings index 0334d4a..2cb0cd7 100644 --- a/level_0/f_memory/data/build/settings +++ b/level_0/f_memory/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library memory.c build_sources_program diff --git a/level_0/f_paths/data/build/settings b/level_0/f_paths/data/build/settings index 43194c1..5f97222 100644 --- a/level_0/f_paths/data/build/settings +++ b/level_0/f_paths/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries build_sources_library build_sources_program diff --git a/level_0/f_pipe/data/build/settings b/level_0/f_pipe/data/build/settings index ed8806d..69820eb 100644 --- a/level_0/f_pipe/data/build/settings +++ b/level_0/f_pipe/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library pipe.c build_sources_program diff --git a/level_0/f_print/data/build/settings b/level_0/f_print/data/build/settings index ccaed24..84fd450 100644 --- a/level_0/f_print/data/build/settings +++ b/level_0/f_print/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library print.c build_sources_program diff --git a/level_0/f_serialized/data/build/settings b/level_0/f_serialized/data/build/settings index 718dfbf..70ecd90 100644 --- a/level_0/f_serialized/data/build/settings +++ b/level_0/f_serialized/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_0/f_strings/data/build/settings b/level_0/f_strings/data/build/settings index fb068f6..1d2823d 100644 --- a/level_0/f_strings/data/build/settings +++ b/level_0/f_strings/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_0/f_types/data/build/settings b/level_0/f_types/data/build/settings index 601bbd6..a2fd3dc 100644 --- a/level_0/f_types/data/build/settings +++ b/level_0/f_types/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library build_sources_program diff --git a/level_1/fl_colors/data/build/settings b/level_1/fl_colors/data/build/settings index 7d71e0e..9593b42 100644 --- a/level_1/fl_colors/data/build/settings +++ b/level_1/fl_colors/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_file -lf_memory build_sources_library colors.c build_sources_program diff --git a/level_1/fl_console/data/build/settings b/level_1/fl_console/data/build/settings index 228786c..b4e5413 100644 --- a/level_1/fl_console/data/build/settings +++ b/level_1/fl_console/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_console -lf_memory build_sources_library console.c build_sources_program diff --git a/level_1/fl_directory/data/build/settings b/level_1/fl_directory/data/build/settings index 37bf7d4..acbe9d1 100644 --- a/level_1/fl_directory/data/build/settings +++ b/level_1/fl_directory/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory build_sources_library directory.c build_sources_program diff --git a/level_1/fl_errors/data/build/settings b/level_1/fl_errors/data/build/settings index 8deffc0..451ec89 100644 --- a/level_1/fl_errors/data/build/settings +++ b/level_1/fl_errors/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc build_sources_library errors.c build_sources_program diff --git a/level_1/fl_file/data/build/settings b/level_1/fl_file/data/build/settings index 84f4e2a..6d3f91c 100644 --- a/level_1/fl_file/data/build/settings +++ b/level_1/fl_file/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_file -lf_memory build_sources_library file.c build_sources_program diff --git a/level_1/fl_fss/data/build/settings b/level_1/fl_fss/data/build/settings index bc7b47f..cdf0039 100644 --- a/level_1/fl_fss/data/build/settings +++ b/level_1/fl_fss/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_file -lf_conversion build_sources_library fss.c fss_basic.c fss_basic_list.c fss_extended.c build_sources_program diff --git a/level_1/fl_serialized/data/build/settings b/level_1/fl_serialized/data/build/settings index 5411ece..b0a08bd 100644 --- a/level_1/fl_serialized/data/build/settings +++ b/level_1/fl_serialized/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory build_sources_library serialized.c build_sources_program diff --git a/level_1/fl_strings/data/build/settings b/level_1/fl_strings/data/build/settings index 8ca4cb3..e8b6991 100644 --- a/level_1/fl_strings/data/build/settings +++ b/level_1/fl_strings/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory build_sources_library strings.c build_sources_program diff --git a/level_2/fll_colors/data/build/settings b/level_2/fll_colors/data/build/settings index d8ac962..46e16ee 100644 --- a/level_2/fll_colors/data/build/settings +++ b/level_2/fll_colors/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lfl_colors build_sources_library colors.c build_sources_program diff --git a/level_2/fll_execute/data/build/settings b/level_2/fll_execute/data/build/settings index 0ee02fe..450bfd3 100644 --- a/level_2/fll_execute/data/build/settings +++ b/level_2/fll_execute/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory build_sources_library execute.c build_sources_program diff --git a/level_2/fll_fss/data/build/settings b/level_2/fll_fss/data/build/settings index c2800a5..854f8b3 100644 --- a/level_2/fll_fss/data/build/settings +++ b/level_2/fll_fss/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_file -lf_conversion -lfl_fss -lfl_errors build_sources_library fss_basic.c fss_basic_list.c fss_extended.c fss_errors.c build_sources_program diff --git a/level_3/firewall/data/build/settings b/level_3/firewall/data/build/settings index 9c7219f..a6dc751 100644 --- a/level_3/firewall/data/build/settings +++ b/level_3/firewall/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lf_conversion -lf_print -lf_file -lfl_fss -lfl_console -lfl_file -lfl_strings -lfl_colors -lfl_directory -lfll_execute -lfll_fss -lfll_colors -lf_pipe build_sources_library firewall.c private-firewall.c build_sources_program main.c diff --git a/level_3/fss_basic_list_read/data/build/settings b/level_3/fss_basic_list_read/data/build/settings index 490787d..4b5c6b1 100644 --- a/level_3/fss_basic_list_read/data/build/settings +++ b/level_3/fss_basic_list_read/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lf_conversion -lf_print -lf_file -lfl_fss -lfl_console -lfl_file -lfl_strings -lfl_colors -lfl_directory -lfll_execute -lfll_fss -lfll_colors -lf_pipe build_sources_library fss_basic_list_read.c build_sources_program main.c diff --git a/level_3/fss_basic_list_write/data/build/settings b/level_3/fss_basic_list_write/data/build/settings index 90e37ae..d6563b4 100644 --- a/level_3/fss_basic_list_write/data/build/settings +++ b/level_3/fss_basic_list_write/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_print -lf_file -lfl_colors -lfll_colors -lfl_errors -lfl_fss -lfll_fss -lfl_file build_sources_library fss_basic_list_write.c build_sources_program main.c diff --git a/level_3/fss_basic_read/data/build/settings b/level_3/fss_basic_read/data/build/settings index 6e333ee..275ac10 100644 --- a/level_3/fss_basic_read/data/build/settings +++ b/level_3/fss_basic_read/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lf_conversion -lf_print -lf_file -lfl_fss -lfl_console -lfl_file -lfl_strings -lfl_colors -lfl_directory -lfll_execute -lfll_fss -lfll_colors -lf_pipe build_sources_library fss_basic_read.c build_sources_program main.c diff --git a/level_3/fss_basic_write/data/build/settings b/level_3/fss_basic_write/data/build/settings index 093ab89..6a03cb3 100644 --- a/level_3/fss_basic_write/data/build/settings +++ b/level_3/fss_basic_write/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_print -lf_file -lfl_colors -lfll_colors -lfl_errors -lfl_fss -lfll_fss -lfl_file build_sources_library fss_basic_write.c build_sources_program main.c diff --git a/level_3/fss_extended_read/data/build/settings b/level_3/fss_extended_read/data/build/settings index db7d2da..a88b021 100644 --- a/level_3/fss_extended_read/data/build/settings +++ b/level_3/fss_extended_read/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lf_conversion -lf_print -lf_file -lfl_fss -lfl_console -lfl_file -lfl_strings -lfl_colors -lfl_directory -lfll_execute -lfll_fss -lfll_colors -lf_pipe build_sources_library fss_extended_read.c build_sources_program main.c diff --git a/level_3/fss_extended_write/data/build/settings b/level_3/fss_extended_write/data/build/settings index 500940c..14d0d4a 100644 --- a/level_3/fss_extended_write/data/build/settings +++ b/level_3/fss_extended_write/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_print -lf_file -lfl_colors -lfll_colors -lfl_errors -lfl_fss -lfll_fss -lfl_file build_sources_library fss_extended_write.c build_sources_program main.c diff --git a/level_3/fss_return_code/data/build/settings b/level_3/fss_return_code/data/build/settings index 481a875..9b3b627 100644 --- a/level_3/fss_return_code/data/build/settings +++ b/level_3/fss_return_code/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_print -lfl_colors -lfll_colors -lfl_errors -lfl_fss -lfll_fss build_sources_library fss_return_code.c build_sources_program main.c diff --git a/level_3/return_code/data/build/settings b/level_3/return_code/data/build/settings index ccfc781..f3c27c9 100644 --- a/level_3/return_code/data/build/settings +++ b/level_3/return_code/data/build/settings @@ -8,6 +8,7 @@ version_minor 4 version_micro 2 build_compiler gcc +build_linker ar build_libraries -lc -lf_memory -lf_console -lfl_console -lf_conversion -lf_pipe -lf_print -lfl_colors -lfll_colors -lfl_errors build_sources_library return_code.c build_sources_program main.c