Skip to content
Snippets Groups Projects
Commit 8a0d887f authored by Zbynek Slajchrt's avatar Zbynek Slajchrt
Browse files

LLVM build scripts treat spaces in paths correctly

parent 43b68b9e
No related branches found
No related tags found
No related merge requests found
...@@ -53,9 +53,9 @@ else ...@@ -53,9 +53,9 @@ else
get_llvm_tool get_llvm_tool
unamestr=`uname` unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then if [[ "$unamestr" == 'Linux' ]]; then
llvm_args="-stdlib=libc++ -I/usr/include/libcxxabi $llvm_args" llvm_args="-stdlib=libc++ -I/usr/include/libcxxabi ${llvm_args[@]}"
fi fi
runit $llvm_tool_bin $llvm_args runit $llvm_tool_bin "${llvm_args[@]}"
ecode=$? ecode=$?
if [[ $ecode -ne 0 ]]; then if [[ $ecode -ne 0 ]]; then
exit $ecode exit $ecode
......
...@@ -51,7 +51,7 @@ then ...@@ -51,7 +51,7 @@ then
else else
llvm_tool=clang llvm_tool=clang
get_llvm_tool get_llvm_tool
runit $llvm_tool_bin $llvm_args runit $llvm_tool_bin "${llvm_args[@]}"
ecode=$? ecode=$?
if [[ $ecode -ne 0 ]]; then if [[ $ecode -ne 0 ]]; then
exit $ecode exit $ecode
......
...@@ -69,7 +69,7 @@ function ll_to_bc() { ...@@ -69,7 +69,7 @@ function ll_to_bc() {
llvm_ir_bc_file=${d}/${f%%.*}.bc llvm_ir_bc_file=${d}/${f%%.*}.bc
} }
runit $FASTR_LLVM_GFORTRAN -fplugin=$FASTR_LLVM_DRAGONEGG -fplugin-arg-dragonegg-emit-ir $llvm_args runit $FASTR_LLVM_GFORTRAN -fplugin=$FASTR_LLVM_DRAGONEGG -fplugin-arg-dragonegg-emit-ir "${llvm_args[@]}"
ll_to_bc ll_to_bc
runit $FASTR_LLVM_GFORTRAN_LLVM_AS $llvm_ir_file -o $llvm_ir_bc_file runit $FASTR_LLVM_GFORTRAN_LLVM_AS $llvm_ir_file -o $llvm_ir_bc_file
runit rm $llvm_ir_file runit rm $llvm_ir_file
......
...@@ -33,13 +33,13 @@ fi ...@@ -33,13 +33,13 @@ fi
function runit() { function runit() {
if [ $run_mode == "echo" ] if [ $run_mode == "echo" ]
then then
echo $@ echo "$@"
elif [ $run_mode == "echorun" ] elif [ $run_mode == "echorun" ]
then then
echo $@ echo "$@"
$@ "$@"
else else
$@ "$@"
fi fi
} }
...@@ -50,7 +50,8 @@ function runit() { ...@@ -50,7 +50,8 @@ function runit() {
# llvm_args: processed arguments to pass to llvm tool, e.g. clang # llvm_args: processed arguments to pass to llvm tool, e.g. clang
function analyze_args() { function analyze_args() {
llvm_args="-g " llvm_args_tmp=()
llvm_args_tmp+=("-g")
if [ $fortran -eq 1 ] if [ $fortran -eq 1 ]
then then
llvm_file_ext='.ll' llvm_file_ext='.ll'
...@@ -59,9 +60,9 @@ function analyze_args() { ...@@ -59,9 +60,9 @@ function analyze_args() {
fi fi
is_link=0 is_link=0
out_file_opt="" out_file_opt=()
llvm_ir_file="" llvm_ir_file=""
llvm_ir_file_opt="" llvm_ir_file_opt=()
c_opt_found=0 c_opt_found=0
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
...@@ -69,7 +70,7 @@ function analyze_args() { ...@@ -69,7 +70,7 @@ function analyze_args() {
case $1 in case $1 in
-c) -c)
c_opt_found=1 c_opt_found=1
llvm_args+="$1 " llvm_args_tmp+=("$1")
;; ;;
-o) -o)
shift shift
...@@ -84,35 +85,42 @@ function analyze_args() { ...@@ -84,35 +85,42 @@ function analyze_args() {
then then
llvm_ir_file=${d}/${f%%.*} llvm_ir_file=${d}/${f%%.*}
llvm_ir_file="${llvm_ir_file}${llvm_file_ext}" llvm_ir_file="${llvm_ir_file}${llvm_file_ext}"
llvm_ir_file_opt="-o ${llvm_ir_file}" llvm_ir_file_opt=("-o" $llvm_ir_file)
else else
out_file_opt="-o $p" out_file_opt=("-o" "$p")
fi fi
;; ;;
*) *)
llvm_args+="$1 " llvm_args_tmp+=("$1")
;; ;;
esac esac
shift shift
done done
llvm_args=()
if [ $fortran -eq 1 ] if [ $fortran -eq 1 ]
then then
if [ $c_opt_found -eq 1 ] if [ $c_opt_found -eq 1 ]
then then
llvm_args="-S $llvm_ir_file_opt $llvm_args " llvm_args+=("-S")
llvm_args+=("${llvm_ir_file_opt[@]}")
llvm_args+=("${llvm_args_tmp[@]}")
else else
llvm_args="$out_file_opt $llvm_args " llvm_args+=("${out_file_opt[@]}")
llvm_args+=("${llvm_args_tmp[@]}")
fi fi
else else
if [ $c_opt_found -eq 1 ] if [ $c_opt_found -eq 1 ]
then then
llvm_args="-emit-llvm $llvm_ir_file_opt $llvm_args " llvm_args+=("-emit-llvm")
llvm_args+=("${llvm_ir_file_opt[@]}")
llvm_args+=("${llvm_args_tmp[@]}")
else else
llvm_args="$out_file_opt $llvm_args " llvm_args+=("${out_file_opt[@]}")
llvm_args+=("${llvm_args_tmp[@]}")
fi fi
fi fi
} }
# Input arguments: # Input arguments:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment