aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils
diff options
context:
space:
mode:
Diffstat (limited to '%HOME%/.bash_utils')
-rw-r--r--%HOME%/.bash_utils/cxx.sh52
1 files changed, 32 insertions, 20 deletions
diff --git a/%HOME%/.bash_utils/cxx.sh b/%HOME%/.bash_utils/cxx.sh
index 6e4df60..858b448 100644
--- a/%HOME%/.bash_utils/cxx.sh
+++ b/%HOME%/.bash_utils/cxx.sh
@@ -37,7 +37,7 @@ _runc_usage() (
echo "$prefix: $msg"
done
- echo "usage: $prefix [-h|--help] [-c|--comp-arg ARG]... [-I DIR]... C_PATH... [-- [PROG_ARG]...]"
+ echo "usage: $prefix [-h|--help] [-c|--comp-arg ARG]... [-I DIR]... [-L DIR]... C_PATH... [-- [PROG_ARG]...]"
)
runc() (
@@ -46,6 +46,7 @@ runc() (
local -a c_flags=(${runc_flags[@]+"${runc_flags[@]}"})
local -a src_files=()
local -a include_dirs=()
+ local -a lib_dirs=()
local -a prog_args
while [ "$#" -gt 0 ]; do
@@ -57,29 +58,27 @@ runc() (
_runc_usage
return 0
;;
-
- -c|--comp-arg)
+ -c|--comp-arg|-I|-L)
if [ "$#" -eq 0 ]; then
_runc_usage "missing argument for parameter: $key" >&2
return 1
fi
+ ;;&
+ -c|--comp-arg)
c_flags+=("$1")
shift
;;
-
-I)
- if [ "$#" -eq 0 ]; then
- _runc_usage "missing argument for parameter: $key" >&2
- return 1
- fi
include_dirs+=("$1")
shift
;;
-
+ -L)
+ lib_dirs+=("$1")
+ shift
+ ;;
--)
break
;;
-
*)
src_files+=("$key")
;;
@@ -108,6 +107,13 @@ runc() (
done < <( _get_absolute_path ${include_dirs[@]+"${include_dirs[@]}"} )
fi
+ if [ "${#lib_dirs[@]}" -gt 0 ]; then
+ local lib_dir
+ while IFS= read -d '' -r lib_dir; do
+ c_flags+=("-L$lib_dir")
+ done < <( _get_absolute_path ${lib_dirs[@]+"${lib_dirs[@]}"} )
+ fi
+
local build_dir
build_dir="$( mktemp --directory )"
@@ -135,7 +141,7 @@ _runcxx_usage() (
echo "$prefix: $msg"
done
- echo "usage: $prefix [-h|--help] [-c|--comp-arg ARG]... [-I DIR]... CPP_PATH... [-- [PROG_ARG]...]"
+ echo "usage: $prefix [-h|--help] [-c|--comp-arg ARG]... [-I DIR]... [-L DIR]... CPP_PATH... [-- [PROG_ARG]...]"
)
runcxx() (
@@ -144,6 +150,7 @@ runcxx() (
local -a cxx_flags=(${runcxx_flags[@]+"${runcxx_flags[@]}"})
local -a src_files=()
local -a include_dirs=()
+ local -a lib_dirs=()
local -a prog_args
while [ "$#" -gt 0 ]; do
@@ -155,29 +162,27 @@ runcxx() (
_runcxx_usage
return 0
;;
-
- -c|--comp-arg)
+ -c|--comp-arg|-I|-L)
if [ "$#" -eq 0 ]; then
_runcxx_usage "missing argument for parameter: $key" >&2
return 1
fi
+ ;;&
+ -c|--comp-arg)
cxx_flags+=("$1")
shift
;;
-
-I)
- if [ "$#" -eq 0 ]; then
- _runc_usage "missing argument for parameter: $key" >&2
- return 1
- fi
include_dirs+=("$1")
shift
;;
-
+ -L)
+ lib_dirs+=("$1")
+ shift
+ ;;
--)
break
;;
-
*)
src_files+=("$key")
;;
@@ -206,6 +211,13 @@ runcxx() (
done < <( _get_absolute_path ${include_dirs[@]+"${include_dirs[@]}"} )
fi
+ if [ "${#lib_dirs[@]}" -gt 0 ]; then
+ local lib_dir
+ while IFS= read -d '' -r lib_dir; do
+ cxx_flags+=("-L$lib_dir")
+ done < <( _get_absolute_path ${lib_dirs[@]+"${lib_dirs[@]}"} )
+ fi
+
local build_dir
build_dir="$( mktemp --directory )"