]> Kevux Git Server - fll/commitdiff
Update: add support for separate build_static setting 0.4.2
authorKevin Day <thekevinday@gmail.com>
Wed, 6 May 2015 02:10:01 +0000 (21:10 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 6 May 2015 02:14:12 +0000 (21:14 -0500)
This allows for building both shared and static libraries and programs.

35 files changed:
build/scripts/generate.sh
level_0/f_colors/data/build/settings
level_0/f_console/data/build/settings
level_0/f_conversion/data/build/settings
level_0/f_errors/data/build/settings
level_0/f_file/data/build/settings
level_0/f_fss/data/build/settings
level_0/f_memory/data/build/settings
level_0/f_paths/data/build/settings
level_0/f_pipe/data/build/settings
level_0/f_print/data/build/settings
level_0/f_serialized/data/build/settings
level_0/f_strings/data/build/settings
level_0/f_types/data/build/settings
level_1/fl_colors/data/build/settings
level_1/fl_console/data/build/settings
level_1/fl_directory/data/build/settings
level_1/fl_errors/data/build/settings
level_1/fl_file/data/build/settings
level_1/fl_fss/data/build/settings
level_1/fl_serialized/data/build/settings
level_1/fl_strings/data/build/settings
level_2/fll_colors/data/build/settings
level_2/fll_execute/data/build/settings
level_2/fll_fss/data/build/settings
level_3/firewall/data/build/settings
level_3/fss_basic_list_read/data/build/settings
level_3/fss_basic_list_write/data/build/settings
level_3/fss_basic_read/data/build/settings
level_3/fss_basic_write/data/build/settings
level_3/fss_extended_read/data/build/settings
level_3/fss_extended_write/data/build/settings
level_3/fss_return_code/data/build/settings
level_3/init/data/build/settings [new file with mode: 0644]
level_3/return_code/data/build/settings

index f47a66400351cb89355d2111bc791038f020ec49..660494d5feedb606c69a0deffd50020f8ae55905 100644 (file)
@@ -194,11 +194,12 @@ generate_id(){
     "build_sources_headers") echo -n 10;;
     "build_sources_settings") echo -n 11;;
     "build_shared") echo -n 12;;
-    "flags_all") echo -n 13;;
-    "flags_shared") echo -n 14;;
-    "flags_static") echo -n 15;;
-    "flags_library") echo -n 16;;
-    "flags_program") echo -n 17;;
+    "build_static") echo -n 13;;
+    "flags_all") echo -n 14;;
+    "flags_shared") echo -n 15;;
+    "flags_static") echo -n 16;;
+    "flags_library") echo -n 17;;
+    "flags_program") echo -n 18;;
   esac
 }
 
@@ -219,7 +220,7 @@ generate_load_settings(){
     exit $failure
   fi
 
-  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
+  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 build_static 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
 
@@ -235,7 +236,7 @@ generate_prepare_build(){
   local level=${variables[$(generate_id project_level)]}
   local alt=$1
 
-  mkdir -vp ${path_build}{includes,programs,libraries,settings} || failure=1
+  mkdir -vp ${path_build}{includes,programs/{shared,static},libraries/{shared,static},settings} || failure=1
 
   if [[ $failure == "" && $level != "" ]] ; then
     mkdir -vp ${path_build}includes/level_$level || failure=1
@@ -271,6 +272,7 @@ generate_operation_build(){
   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 static=${variables[$(generate_id build_static)]}
   local sources_library=${variables[$(generate_id build_sources_library)]}
   local sources_program=${variables[$(generate_id build_sources_program)]}
   local sources_headers=${variables[$(generate_id build_sources_headers)]}
@@ -279,6 +281,13 @@ generate_operation_build(){
   local i=
   local alt=$1
 
+
+  if [[ $shared != "yes" && $static != "yes" ]] ;then
+    echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.$c_reset"
+    generate_cleanup
+    exit -1
+  fi
+
   if [[ $sources_settings != "" ]] ; then
     for i in $sources_settings ; do
       cp -vf $path_c$i ${path_build}settings/ || failure=1
@@ -298,12 +307,12 @@ generate_operation_build(){
         sources="$sources$path_c$i "
       done
 
-      echo $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/lib$name.so.$major.$minor.$micro $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_library)]}
-      $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/lib$name.so.$major.$minor.$micro $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_library)]} || failure=1
+      echo $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_library)]}
+      $compiler $sources -shared -Wl,-soname,lib$name.so.$major -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_library)]} || failure=1
 
       if [[ $failure == "" ]] ; then
-        ln -vsf lib$name.so.$major.$minor.$micro ${path_build}libraries/lib$name.so.$major || failure=1
-        ln -vsf lib$name.so.$major ${path_build}libraries/lib$name.so || failure=1
+        ln -vsf lib$name.so.$major.$minor.$micro ${path_build}libraries/shared/lib$name.so.$major || failure=1
+        ln -vsf lib$name.so.$major ${path_build}libraries/shared/lib$name.so || failure=1
       fi
     fi
 
@@ -319,17 +328,19 @@ generate_operation_build(){
         sources="$sources$path_c$i "
       done
 
-      echo $compiler $sources -o ${path_build}programs/$name $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]} 
-      $compiler $sources -o ${path_build}programs/$name $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]} || failure=1
+      echo $compiler $sources -o ${path_build}programs/shared/$name $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]}
+      $compiler $sources -o ${path_build}programs/shared/$name $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]} || failure=1
     fi
-  elif [[ $failure == "" ]] ; then
+  fi
+
+  if [[ $failure == "" && $static == "yes" ]] ; then
     sources=
     if [[ $sources_library != "" ]] ; then
       for i in $sources_library ; do
         sources="$sources${path_build}libraries/$i.o "
 
-        echo $compiler $path_c$i -c -static -o ${path_build}libraries/$i.o $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} 
-        $compiler $path_c$i -c -static -o ${path_build}libraries/$i.o $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} || failure=1
+        echo $compiler $path_c$i -c -static -o ${path_build}libraries/static/$i.o $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]}
+        $compiler $path_c$i -c -static -o ${path_build}libraries/static/$i.o $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} || failure=1
 
         if [[ $failure == "1" ]] ; then
           break;
@@ -337,8 +348,8 @@ generate_operation_build(){
       done
 
       if [[ $failure == "" ]] ; then
-        echo $linker rcs ${path_build}libraries/lib$name.a $sources
-        $linker rcs ${path_build}libraries/lib$name.a $sources || failure=1
+        echo $linker rcs ${path_build}libraries/static/lib$name.a $sources
+        $linker rcs ${path_build}libraries/static/lib$name.a $sources || failure=1
       fi
     fi
 
@@ -354,8 +365,8 @@ generate_operation_build(){
         sources="$sources$path_c$i "
       done
 
-      echo $compiler -static -o ${path_build}programs/$name $sources $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]}
-      $compiler -static -o ${path_build}programs/$name $sources $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]} || failure=1
+      echo $compiler -static -o ${path_build}programs/static/$name $sources $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]}
+      $compiler -static -o ${path_build}programs/static/$name $sources $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]} || failure=1
     fi
   fi
 
index 199bfed4ff2c3ba36ea9b30907e5f3f865ff0789..93bde6852af97f05305f8ed75a8f8f7c8654564b 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers colors.h 
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index f12247e7bf3961e043050e816604fe4b47d2e465..57f144ae42917d5286fcfb1fdbd3ba6fcfd17fa6 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library console.c
 build_sources_program 
 build_sources_headers console.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index a3feb362a1917142bc4be36fa66bb671b89d31b3..2c64c78ca1e2a70a883d47c8c2fc6df96d33fbc9 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library conversion.c
 build_sources_program 
 build_sources_headers conversion.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index cd8bbf934d9853b52780eb8ecc9a0832111456f8..98e9968b4507b5885fdccdca9cc7d0bfc5c69fb4 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers errors.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 6c3d5043a9062f5efa65f3a121d7c7148cbc683e..501e6e65f952dd15e1a680e1bb9e034ff2c737ba 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library file.c
 build_sources_program 
 build_sources_headers file.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index cac2f911e57ea795effc2ffc24ee10e4d40e50e4..d9a3afefe1fb82df25eeb8b4d96af9fb2b3a69e3 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers fss.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 2cb0cd7c697bf46c0a492a0797f9acccf52cef05..767b67c5b593f0f1b839a6d27be70dbb5f387c39 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library memory.c
 build_sources_program 
 build_sources_headers memory.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 5f97222345e7d3bf139fcc9f127318dff3cdedf4..036654fff60c442c6c9a9d1a668990da7c846531 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers fll_paths.h filesystem_paths.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 69820eb9b5cbd6055f979013ab0b168a0e9eee11..c8530cc35c41128546a5b046b7519692b15bcb87 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library pipe.c
 build_sources_program 
 build_sources_headers pipe.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 84fd450eca8ee1a2b48774fc90f8d75cdf225d08..eeaa015fc95de8ecf12018dc98719e643ce05f5f 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library print.c
 build_sources_program
 build_sources_headers print.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 70ecd90c9dd3a9bfc1ac9b45f9888298ed5b4185..6659c4437a80844c4e1b35e4aabfbbe90dd6c19b 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers serialized.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 1d2823d8f79704d543e500ee94b2caca95b539c7..6a83655227cd31458be8c1efea3525b97afd68f5 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program 
 build_sources_headers strings.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index a2fd3dc495d28e91c6ddb6960d55ace1fbee8b84..1be5c681a9ca2e3628a99c21153419f06bdda675 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library
 build_sources_program
 build_sources_headers types.h types_array.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 892ca959da9bdfb6eb8989913881c2d58bc7cc2f..4c34fdc113bdbef193a3b497023f0ec13658f7b6 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library colors.c
 build_sources_program 
 build_sources_headers colors.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index dd13071007e4948ca81b08ce55445dff7eaed88b..b95d88a443dd205f08f2bb2120449ec4f0119e61 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library console.c
 build_sources_program 
 build_sources_headers console.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index c95be94afc5b17d8292499ee41faeff70255bf80..2f017ef0607ec5d80e417f37d83502324508371c 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library directory.c
 build_sources_program 
 build_sources_headers directory.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 451ec8919d9297b269e9b39745f16178b6d39457..89fffdc7d63e3595e66e987c6cb9342fed934465 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library errors.c
 build_sources_program 
 build_sources_headers errors.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 3035c95c27f79c1906fa9d1140ee1c9305436cff..dba658f65ab6d014007888c95b3879e1014f28a9 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library file.c
 build_sources_program 
 build_sources_headers file.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index c42cb1f221854abd480c446b400bbb2a2861a7f0..44abbbe6a5380d40bbb52127d86f10b9f39138f2 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss.c fss_basic.c fss_basic_list.c fss_extended.c
 build_sources_program 
 build_sources_headers fss.h fss_basic.h fss_basic_list.h fss_errors.h fss_extended.h fss_macro.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 84b1b34aacb839f01a0652323b525bc973fbf3e9..d80a389794e2c88d3adcbf827a2eac0277eb8f16 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library serialized.c
 build_sources_program 
 build_sources_headers serialized.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index f1c1d00b7d73473d43175e0968d715371317eb60..a693b83b5a9495cc471a43cc79dffa2e7d6ea2fb 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library strings.c
 build_sources_program 
 build_sources_headers strings.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index c07a80c0f458f5da872b3a94f83e7be94a4a5cfc..452d3a3cfdbe039fe05b9dcf2dfc7cf909d95d94 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library colors.c
 build_sources_program 
 build_sources_headers colors.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 29a7ec89b9329945766bf697a9d53ee521802819..01c55856ba924961545ee08e70eb0945f21f2734 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library execute.c
 build_sources_program 
 build_sources_headers execute.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 8a18c3bac44c70b61301d957034c1df2d392ae90..aecd169ad63fb7abdb378df85d2614d40f4ad093 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_basic.c fss_basic_list.c fss_extended.c fss_errors.c
 build_sources_program
 build_sources_headers fss_basic.h fss_basic_list.h fss_extended.h fss_errors.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 661e8cf909ed8e6db6012772ce979a0bbeabc29d..fd812215284b3ac93a257f502d5d92d7967818c6 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library firewall.c private-firewall.c
 build_sources_program main.c
 build_sources_headers firewall.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index f12ba9bfae564cd56816c388c854c18792cad337..3c878e8e4fa862a5864378e6746b543ce4921c8f 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_basic_list_read.c
 build_sources_program main.c
 build_sources_headers fss_basic_list_read.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 4a1d422e110b68f7d60a9eeec98742b44c966d90..e2110178bd472207e6966e4e143b48a6f4d804dd 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_basic_list_write.c
 build_sources_program main.c
 build_sources_headers fss_basic_list_write.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index d5a374f85f83d73de9095ced7bf2d28b20151ee2..ca3b0ed5216b73316504a23aa935977f6d47f9fa 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_basic_read.c
 build_sources_program main.c
 build_sources_headers fss_basic_read.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 1b87dcbfbbe825fa32ff8a27be450494d0a2bba2..350a4b1f0c7677ac824fef3b7d4b7dce10f4a92f 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_basic_write.c
 build_sources_program main.c
 build_sources_headers fss_basic_write.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index c4a7805757da6679ad7bc0dbf1e63ab8da127d8a..eac4c6d88f0d95a63967be61d69ace799461380b 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_extended_read.c
 build_sources_program main.c
 build_sources_headers fss_extended_read.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 283ad37852593b9d17faed8efbdd6e598d4e1d68..fcc6a4d4511e16edf5b3d66b24a8775a2c88e86f 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_extended_write.c
 build_sources_program main.c
 build_sources_headers fss_extended_write.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
index 57697e27ecd5a2d44955545564cd7bae23e56f68..c80146801eeaf596a878a1adf3601aa85da1ecb1 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library fss_return_code.c
 build_sources_program main.c
 build_sources_headers fss_return_code.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared
diff --git a/level_3/init/data/build/settings b/level_3/init/data/build/settings
new file mode 100644 (file)
index 0000000..af16465
--- /dev/null
@@ -0,0 +1,24 @@
+# fss-0000
+
+project_name init
+project_level 3
+
+version_major 0
+version_minor 4
+version_micro 2
+
+build_compiler gcc
+build_linker ar
+build_libraries -lfll_colors -lfll_fss -lfll_execute -lfl_directory -lfl_colors -lfl_strings -lfl_file -lfl_console -lfl_fss -lf_pipe -lf_file -lf_print -lf_conversion -lf_console -lf_memory -lc
+build_sources_library init.c private-init.c
+build_sources_program main.c
+build_sources_headers init.h
+build_shared yes
+build_static yes
+build_static yes
+
+flags_all -z now
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE -lfirewall
index 35bfce1e000b4f82262e40ff374777f0cb23d82a..4c4e3c925f655a01b651f091b314733f8e3f024c 100644 (file)
@@ -14,6 +14,7 @@ build_sources_library return_code.c
 build_sources_program main.c
 build_sources_headers return_code.h
 build_shared yes
+build_static yes
 
 flags_all -z now
 flags_shared