]> Kevux Git Server - fll/commitdiff
Feature: work directory support
authorKevin Day <thekevinday@gmail.com>
Mon, 29 Jul 2019 04:01:42 +0000 (23:01 -0500)
committerKevin Day <thekevinday@gmail.com>
Mon, 29 Jul 2019 22:40:08 +0000 (17:40 -0500)
Work Directory provides an easier way for developers to compile and test a particular set of FLL libraries and programs without conflicting with the host system.

If the host system has some version of the FLL project installed, the versions in the work directory will be used instead of the system directories.

Specifying the work directory is done via the '-w' or '--work_directory' commands.

To better achieve this functionality in the install.sh script, four new additional parameters were created:
- --libraries-static
- --libraries-shared
- --programs-static
- --programs-shared

These provide additional relative or absolute paths for installing the programs and libraries into.
The relative paths for --libraries-static and --libraries-shared is the library directory (which can be specified via --libdir).
The relative paths for --programs-static and --programs-shared is the program directory (which can be specified via --bindir).

build/scripts/generate.sh
build/scripts/install.sh

index 9fbf2f63aaf201230d68cebad86f2f17a5c92d33..1497da800c86cd6e86568b69eebbab3f690d39a2 100644 (file)
@@ -37,6 +37,7 @@ generate_main(){
   local path_s=data/settings/
   local path_bash=sources/bash/
   local project_built=
+  local work_directory=
 
   local enable_shared=
   local enable_static=
@@ -70,6 +71,8 @@ generate_main(){
           grab_next=path_s
         elif [[ $p == "-p" || $p == "--project" ]] ; then
           grab_next=project_built
+        elif [[ $p == "-w" || $p == "--work_directory" ]] ; then
+          grab_next=work_directory
         elif [[ $p == "--enable-shared" ]] ; then
           enable_shared="yes"
         elif [[ $p == "--disable-shared" ]] ; then
@@ -96,6 +99,8 @@ generate_main(){
           path_s=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
         elif [[ $grab_next == "project_built" ]] ; then
           project_built="-$(echo $p | sed -e 's|/*$||')"
+        elif [[ $grab_next == "work_directory" ]] ; then
+          work_directory=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
         fi
 
         grab_next=
@@ -122,6 +127,11 @@ generate_main(){
   #  exit 0
   #fi
 
+  if [[ $work_directory != "" && ! -d $work_directory ]] ; then
+    echo -e "${c_error}ERROR: the work directory $c_notice$work_directory$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
   if [[ ! -d $path_c && ( ${variables[$(generate_id build_sources_library)]} != "" || ${variables[$(generate_id build_sources_program)]} != "" || ${variables[$(generate_id build_sources_headers)]} != "" ) ]] ; then
     echo -e "${c_error}ERROR: the c path of '$c_notice$path_c$c_error' is invalid.$c_reset"
     generate_cleanup
@@ -189,12 +199,13 @@ generate_help(){
   echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset   Print the version number of this program"
   echo
   echo -e "${c_highlight}Generate Options:$c_reset"
-  echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset}      Specify a custom build directory"
-  echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset}   Specify a custom build settings file"
-  echo -e " -${c_important}B$c_reset, --${c_important}bash_path${c_reset}  Specify a custom path to the bash source files"
-  echo -e " -${c_important}c$c_reset, --${c_important}c_path${c_reset}     Specify a custom path to the c source files"
-  echo -e " -${c_important}S$c_reset, --${c_important}s_path${c_reset}     Specify a custom path to the settings files"
-  echo -e " -${c_important}p$c_reset, --${c_important}project${c_reset}    Specify a project name for storing built status"
+  echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset}           Custom build directory"
+  echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset}        Custom build settings file"
+  echo -e " -${c_important}B$c_reset, --${c_important}bash_path${c_reset}       Custom path to the bash source files"
+  echo -e " -${c_important}c$c_reset, --${c_important}c_path${c_reset}          Custom path to the c source files"
+  echo -e " -${c_important}S$c_reset, --${c_important}s_path${c_reset}          Custom path to the settings files"
+  echo -e " -${c_important}p$c_reset, --${c_important}project${c_reset}         Project name for storing built status"
+  echo -e " -${c_important}w$c_reset, --${c_important}work_directory${c_reset}  Use includes/libraries from this directory instead of system"
   echo
   echo -e "${c_highlight}Special Options:$c_reset"
   echo -e " --${c_important}enable-shared${c_reset}   Forcibly do install shared files"
@@ -299,7 +310,8 @@ generate_operation_build(){
   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 ${variables[$(generate_id flags_all)]} ${variables[$(generate_id build_libraries)]}"
+  local arguments="${variables[$(generate_id build_libraries)]}"
+  local arguments_include="-I${path_build}includes"
   local arguments_shared="-L${path_build}libraries/shared"
   local arguments_static="-L${path_build}libraries/static"
   local shared=${variables[$(generate_id build_shared)]}
@@ -309,9 +321,20 @@ generate_operation_build(){
   local sources_headers=${variables[$(generate_id build_sources_headers)]}
   local sources_settings=${variables[$(generate_id build_sources_settings)]}
   local sources=
+  local flags_all=${variables[$(generate_id flags_all)]}
+  local flags_shared=${variables[$(generate_id flags_shared)]}
+  local flags_static=${variables[$(generate_id flags_static)]}
+  local flags_library=${variables[$(generate_id flags_library)]}
+  local flags_program=${variables[$(generate_id flags_program)]}
   local i=
   local alt=$1
 
+  if [[ $work_directory != "" ]] ; then
+    flags_all="-I${work_directory}includes/ $flags_all"
+    flags_shared="-L${work_directory}libraries/shared/ $flags_shared"
+    flags_static="-L${work_directory}libraries/static/ $flags_static"
+  fi
+
   if [[ $enable_shared == "yes" ]] ; then
     shared="yes"
   elif [[ $enable_shared == "no" ]] ; then
@@ -349,8 +372,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 ${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_shared $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_shared $arguments_include $flags_all $arguments $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 $flags_all $arguments $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
@@ -370,8 +393,8 @@ generate_operation_build(){
         sources="$sources$path_c$i "
       done
 
-      echo $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]}
-      $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments ${variables[$(generate_id flags_shared)]} ${variables[$(generate_id flags_program)]} || failure=1
+      echo $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $flags_all $arguments $flags_shared $flags_program
+      $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $flags_all $arguments $flags_shared $flags_program || failure=1
     fi
   fi
 
@@ -381,8 +404,8 @@ generate_operation_build(){
       for i in $sources_library ; do
         sources="$sources${path_build}objects/$i.o "
 
-        echo $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]}
-        $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_library)]} || failure=1
+        echo $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_library
+        $compiler $path_c$i -c -static -o ${path_build}objects/$i.o $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_library || failure=1
 
         if [[ $failure == "1" ]] ; then
           break;
@@ -407,8 +430,8 @@ generate_operation_build(){
         sources="$sources$path_c$i "
       done
 
-      echo $compiler -static -o ${path_build}programs/static/$name $sources $arguments_static $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]}
-      $compiler -static -o ${path_build}programs/static/$name $sources $arguments_static $arguments ${variables[$(generate_id flags_static)]} ${variables[$(generate_id flags_program)]} || failure=1
+      echo $compiler -static -o ${path_build}programs/static/$name $sources $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_program
+      $compiler -static -o ${path_build}programs/static/$name $sources $arguments_static $arguments_include $flags_all $arguments $flags_static $flags_program || failure=1
     fi
   fi
 
index 568dcebed15ff764a060a250359251c18c933d9b..df581c9ecba33740b732d1592fa5398e65d1040b 100644 (file)
@@ -48,6 +48,12 @@ install_main(){
   local destination_programs=bin/
   local destination_includes=include/
   local destination_libraries=lib/
+  local destination_libraries_static=
+  local destination_libraries_shared=
+  local destination_programs_static=
+  local destination_programs_shared=
+
+  local work_directory=
 
   local enable_shared=
   local enable_static=
@@ -81,6 +87,8 @@ install_main(){
           grab_next=includedir
         elif [[ $p == "-L" || $p == "--libdir" ]] ; then
           grab_next=libdir
+        elif [[ $p == "-w" || $p == "--work_directory" ]] ; then
+          grab_next=work_directory
         elif [[ $p == "--enable-shared" ]] ; then
           enable_shared="yes"
         elif [[ $p == "--disable-shared" ]] ; then
@@ -89,6 +97,14 @@ install_main(){
           enable_static="yes"
         elif [[ $p == "--disable-static" ]] ; then
           enable_static="no"
+        elif [[ $p == "--libraries-static" ]] ; then
+          grab_next="destination_libraries_static"
+        elif [[ $p == "--libraries-shared" ]] ; then
+          grab_next="destination_libraries_shared"
+        elif [[ $p == "--programs-static" ]] ; then
+          grab_next="destination_programs_static"
+        elif [[ $p == "--programs-shared" ]] ; then
+          grab_next="destination_programs_shared"
         elif [[ $operation_failure == "" ]] ; then
           operation="$p"
           operation_failure=fail-unsupported
@@ -106,6 +122,16 @@ install_main(){
           destination_includes=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
         elif [[ $grab_next == "libdir" ]] ; then
           destination_libraries=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+        elif [[ $grab_next == "work_directory" ]] ; then
+          work_directory=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+        elif [[ $grab_next == "destination_libraries_static" ]] ; then
+          destination_libraries_static=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+        elif [[ $grab_next == "destination_libraries_shared" ]] ; then
+          destination_libraries_shared=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+        elif [[ $grab_next == "destination_programs_static" ]] ; then
+          destination_programs_static=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
+        elif [[ $grab_next == "destination_programs_shared" ]] ; then
+          destination_programs_shared=$(echo $p | sed -e 's|^//*|/|' -e 's|/*$|/|')
         fi
 
         grab_next=
@@ -126,50 +152,102 @@ install_main(){
   if [[ $operation_failure == "fail-unsupported" ]] ; then
     echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset"
     exit 1
-  else
-    if [[ $prefix == "" && ! -d $path_build ]] ; then
-      echo -e "${c_error}ERROR: the build path $c_notice$path_build$c_error is not a valid directory.$c_reset"
-      exit 1
-    fi
+  fi
+
+  if [[ $prefix == "" && ! -d $path_build ]] ; then
+    echo -e "${c_error}ERROR: the build path $c_notice$path_build$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
+  if [[ $destination_prefix != "" && ! -d $destination_prefix ]] ; then
+    echo -e "${c_error}ERROR: the destination prefix $c_notice$destination_prefix$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
 
-    if [[ $destination_prefix != "" && ! -d $destination_prefix ]] ; then
-      echo -e "${c_error}ERROR: the destination prefix $c_notice$destination_prefix$c_error is not a valid directory.$c_reset"
-      exit 1
+  if [[ $destination_prefix != "" ]] ; then
+    if [[ $(echo $destination_programs | grep -o '^/') == "" ]] ; then
+      destination_programs="$destination_prefix$destination_programs"
     fi
 
-    if [[ $destination_prefix != "" ]] ; then
-      if [[ $(echo $destination_programs | grep -o '^/') == "" ]] ; then
-        destination_programs="$destination_prefix$destination_programs"
-      fi
+    if [[ $(echo $destination_includes | grep -o '^/') == "" ]] ; then
+      destination_includes="$destination_prefix$destination_includes"
+    fi
 
-      if [[ $(echo $destination_includes | grep -o '^/') == "" ]] ; then
-        destination_includes="$destination_prefix$destination_includes"
-      fi
+    if [[ $(echo $destination_libraries | grep -o '^/') == "" ]] ; then
+      destination_libraries="$destination_prefix$destination_libraries"
+    fi
+  fi
 
-      if [[ $(echo $destination_libraries | grep -o '^/') == "" ]] ; then
-        destination_libraries="$destination_prefix$destination_libraries"
-      fi
+  if [[ $destination_libraries_static != "" ]] ; then
+    if [[ $(echo $destination_libraries_static | grep -o '^/') == "" ]] ; then
+      destination_libraries_static=$destination_libraries$destination_libraries_static
     fi
+  else
+    destination_libraries_static=$destination_libraries
+  fi
 
-    if [[ ! -d $destination_programs ]] ; then
-      echo -e "${c_error}ERROR: the destination bindir $c_notice$destination_programs$c_error is not a valid directory.$c_reset"
-      exit 1
+  if [[ $destination_libraries_shared != "" ]] ; then
+    if [[ $(echo $destination_libraries_shared | grep -o '^/') == "" ]] ; then
+      destination_libraries_shared=$destination_libraries$destination_libraries_shared
     fi
+  else
+    destination_libraries_shared=$destination_libraries
+  fi
 
-    if [[ ! -d $destination_includes ]] ; then
-      echo -e "${c_error}ERROR: the destination incluedir $c_notice$destination_includes$c_error is not a valid directory.$c_reset"
-      exit 1
+  if [[ $destination_programs_static != "" ]] ; then
+    if [[ $(echo $destination_programs_static | grep -o '^/') == "" ]] ; then
+      destination_programs_static=$destination_programs$destination_programs_static
     fi
+  else
+    destination_programs_static=$destination_programs
+  fi
 
-    if [[ ! -d $destination_libraries ]] ; then
-      echo -e "${c_error}ERROR: the destination libdir $c_notice$destination_libraries$c_error is not a valid directory.$c_reset"
-      exit 1
+  if [[ $destination_programs_shared != "" ]] ; then
+    if [[ $(echo $destination_programs_shared | grep -o '^/') == "" ]] ; then
+      destination_programs_shared=$destination_programs$destination_programs_shared
     fi
+  else
+    destination_programs_shared=$destination_programs
+  fi
+
+  if [[ $work_directory != "" && ! -d $work_directory ]] ; then
+    echo -e "${c_error}ERROR: the work directory $c_notice$work_directory$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
+  if [[ ! -d $destination_programs ]] ; then
+    echo -e "${c_error}ERROR: the destination bindir $c_notice$destination_programs$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
+  if [[ ! -d $destination_programs_static ]] ; then
+    echo -e "${c_error}ERROR: the destination (static) bindir $c_notice$destination_programs_static$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
+  if [[ ! -d $destination_programs_shared ]] ; then
+    echo -e "${c_error}ERROR: the destination (shared) bindir $c_notice$destination_programs_shared$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
 
-    install_load_settings
+  if [[ ! -d $destination_includes ]] ; then
+    echo -e "${c_error}ERROR: the destination incluedir $c_notice$destination_includes$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
 
-    install_perform_install
+  if [[ ! -d $destination_libraries_static ]] ; then
+    echo -e "${c_error}ERROR: the destination (static) libdir $c_notice$destination_libraries_static$c_error is not a valid directory.$c_reset"
+    exit 1
   fi
+
+  if [[ ! -d $destination_libraries_shared ]] ; then
+    echo -e "${c_error}ERROR: the destination (shared) libdir $c_notice$destination_libraries_shared$c_error is not a valid directory.$c_reset"
+    exit 1
+  fi
+
+  install_load_settings
+
+  install_perform_install
 }
 
 install_handle_colors(){
@@ -207,18 +285,23 @@ install_help(){
   echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset   Print the version number of this program"
   echo
   echo -e "${c_highlight}Install Options:$c_reset"
-  echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset}       Specify a custom build directory"
-  echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset}    Specify a custom build settings file"
-  echo -e " -${c_important}P$c_reset, --${c_important}prefix${c_reset}      Specify a custom destination prefix"
-  echo -e " -${c_important}B$c_reset, --${c_important}bindir${c_reset}      Specify a custom destination bin/ directory"
-  echo -e " -${c_important}I$c_reset, --${c_important}includedir${c_reset}  Specify a custom destination include/ directory"
-  echo -e " -${c_important}L$c_reset, --${c_important}libdir${c_reset}      Specify a custom destination lib/ directory"
+  echo -e " -${c_important}b$c_reset, --${c_important}build${c_reset}           Custom build directory"
+  echo -e " -${c_important}s$c_reset, --${c_important}settings${c_reset}        Custom build settings file"
+  echo -e " -${c_important}P$c_reset, --${c_important}prefix${c_reset}          Custom destination prefix"
+  echo -e " -${c_important}B$c_reset, --${c_important}bindir${c_reset}          Custom destination bin/ directory"
+  echo -e " -${c_important}I$c_reset, --${c_important}includedir${c_reset}      Custom destination include/ directory"
+  echo -e " -${c_important}L$c_reset, --${c_important}libdir${c_reset}          Custom destination lib/ directory"
+  echo -e " -${c_important}w$c_reset, --${c_important}work_directory${c_reset}  Install to this directory instead of system"
   echo
   echo -e "${c_highlight}Special Options:$c_reset"
-  echo -e " --${c_important}enable-shared${c_reset}   Forcibly do install shared files"
-  echo -e " --${c_important}disable-shared${c_reset}  Forcibly do not install shared files"
-  echo -e " --${c_important}enable-static${c_reset}   Forcibly do install static files"
-  echo -e " --${c_important}disable-static${c_reset}  Forcibly do not install static files"
+  echo -e " --${c_important}enable-shared${c_reset}     Forcibly do install shared files"
+  echo -e " --${c_important}disable-shared${c_reset}    Forcibly do not install shared files"
+  echo -e " --${c_important}enable-static${c_reset}     Forcibly do install static files"
+  echo -e " --${c_important}disable-static${c_reset}    Forcibly do not install static files"
+  echo -e " --${c_important}libraries-static${c_reset}  Custom destination for static libraries"
+  echo -e " --${c_important}libraries-shared${c_reset}  Custom destination for shared libraries"
+  echo -e " --${c_important}programs-static${c_reset}   Custom destination for static programs"
+  echo -e " --${c_important}programs-shared${c_reset}   Custom destination for shared programs"
   echo
 }
 
@@ -278,7 +361,83 @@ install_perform_install(){
     build_static="no"
   fi
 
-  if [[ $build_sources_headers != "" ]] ; then
+  if [[ $work_directory != "" ]] ; then
+    if [[ ! -d ${work_directory}programs ]] ; then
+      mkdir -v ${work_directory}programs
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}programs$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}programs/shared ]] ; then
+      mkdir -v ${work_directory}programs/shared
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}programs/shared$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}programs/static ]] ; then
+      mkdir -v ${work_directory}programs/static
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}programs/static$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}libraries ]] ; then
+      mkdir -v ${work_directory}libraries
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}libraries$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}libraries/shared ]] ; then
+      mkdir -v ${work_directory}libraries/shared
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}libraries/shared$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}libraries/static ]] ; then
+      mkdir -v ${work_directory}libraries/static
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}libraries/static$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ ! -d ${work_directory}includes ]] ; then
+      mkdir -v ${work_directory}includes
+
+      if [[ $? -ne 0 ]] ; then
+        echo -e "${c_error}ERROR: failed to create work directories $c_notice${work_directory}includes$c_error.$c_reset"
+        failure=1
+      fi
+    fi
+
+    if [[ $failure == "" ]] ; then
+      destination_prefix=$work_directory
+      destination_programs=${work_directory}programs/
+      destination_programs_static=${destination_programs}static/
+      destination_programs_shared=${destination_programs}shared/
+      destination_includes=${work_directory}includes/
+      destination_libraries=${work_directory}libraries/
+      destination_libraries_static=${destination_libraries}static/
+      destination_libraries_shared=${destination_libraries}shared/
+    fi
+  fi
+
+  if [[ $failure == "" && $build_sources_headers != "" ]] ; then
     echo
     echo -e "${c_highlight}Installing Includes to: $c_reset$c_notice$destination_includes$c_reset${c_highlight}.$c_reset"
     cp -vR $path_build${path_includes}* $destination_includes
@@ -292,22 +451,22 @@ install_perform_install(){
   if [[ $failure == "" && ( $build_sources_library != "" || $build_sources_program != "" ) ]] ; then
     if [[ $build_static == "yes" ]] ; then
       echo
-      echo -e "${c_highlight}Installing (static) Libraries to: $c_reset$c_notice$destination_libraries$c_reset${c_highlight}.$c_reset"
-      cp -vR $path_build$path_libraries${path_static}* $destination_libraries
+      echo -e "${c_highlight}Installing (static) Libraries to: $c_reset$c_notice$destination_libraries_static$c_reset${c_highlight}.$c_reset"
+      cp -vR $path_build$path_libraries${path_static}* $destination_libraries_static
 
       if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_libraries$path_static$c_error to $c_notice$destination_libraries$c_error.$c_reset"
+        echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_libraries$path_static$c_error to $c_notice$destination_libraries_static$c_error.$c_reset"
         failure=1
       fi
     fi
 
     if [[ $failure == "" && $build_shared == "yes" ]] ; then
       echo
-      echo -e "${c_highlight}Installing (shared) Libraries to: $c_reset$c_notice$destination_libraries$c_reset${c_highlight}.$c_reset"
-      cp -vR $path_build$path_libraries${path_shared}* $destination_libraries
+      echo -e "${c_highlight}Installing (shared) Libraries to: $c_reset$c_notice$destination_libraries_shared$c_reset${c_highlight}.$c_reset"
+      cp -vR $path_build$path_libraries${path_shared}* $destination_libraries_shared
 
       if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_libraries$build_shared$c_error to $c_notice$destination_libraries$c_error.$c_reset"
+        echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_libraries$build_shared$c_error to $c_notice$destination_libraries_shared$c_error.$c_reset"
         failure=1
       fi
     fi
@@ -316,22 +475,22 @@ install_perform_install(){
   if [[ $failure == "" && $build_sources_program != "" ]] ; then
     if [[ $build_static == "yes" ]] ; then
       echo
-      echo -e "${c_highlight}Installing (static) Programs to: $c_reset$c_notice$destination_programs$c_reset${c_highlight}.$c_reset"
-      cp -vR $path_build$path_programs${path_static}* $destination_programs
+      echo -e "${c_highlight}Installing (static) Programs to: $c_reset$c_notice$destination_programs_static$c_reset${c_highlight}.$c_reset"
+      cp -vR $path_build$path_programs${path_static}* $destination_programs_static
 
       if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_programs$path_static$c_error to $c_notice$destination_programs$c_error.$c_reset"
+        echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_programs$path_static$c_error to $c_notice$destination_programs_static$c_error.$c_reset"
         failure=1
       fi
     fi
 
     if [[ $failure == "" && $build_shared == "yes" ]] ; then
       echo
-      echo -e "${c_highlight}Installing (shared) Programs to: $c_reset$c_notice$destination_programs$c_reset${c_highlight}.$c_reset"
-      cp -vR $path_build$path_programs${path_shared}* $destination_programs
+      echo -e "${c_highlight}Installing (shared) Programs to: $c_reset$c_notice$destination_programs_shared$c_reset${c_highlight}.$c_reset"
+      cp -vR $path_build$path_programs${path_shared}* $destination_programs_shared
 
       if [[ $? -ne 0 ]] ; then
-        echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_programs$build_shared$c_error to $c_notice$destination_programs$c_error.$c_reset"
+        echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_programs$build_shared$c_error to $c_notice$destination_programs_shared$c_error.$c_reset"
         failure=1
       fi
     fi