summaryrefslogtreecommitdiff
path: root/lib/spack/env/cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-xlib/spack/env/cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index c4e51834a5..b06c6fd6fc 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -1,14 +1,14 @@
#!/bin/bash
##############################################################################
-# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
-# For details, see https://github.com/llnl/spack
-# Please also see the LICENSE file for our notice and the LGPL.
+# For details, see https://github.com/spack/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
@@ -45,6 +45,7 @@ parameters=(
SPACK_PREFIX
SPACK_ENV_PATH
SPACK_DEBUG_LOG_DIR
+ SPACK_DEBUG_LOG_ID
SPACK_COMPILER_SPEC
SPACK_CC_RPATH_ARG
SPACK_CXX_RPATH_ARG
@@ -58,7 +59,7 @@ parameters=(
# The default compiler flags are passed from these variables:
# SPACK_CFLAGS, SPACK_CXXFLAGS, SPACK_FCFLAGS, SPACK_FFLAGS,
# SPACK_LDFLAGS, SPACK_LDLIBS
-# Debug env var is optional; set to true for debug logging:
+# Debug env var is optional; set to "TRUE" for debug logging:
# SPACK_DEBUG
# Test command is used to unit test the compiler script.
# SPACK_TEST_COMMAND
@@ -98,25 +99,25 @@ case "$command" in
cpp)
mode=cpp
;;
- cc|c89|c99|gcc|clang|icc|pgcc|xlc)
+ cc|c89|c99|gcc|clang|icc|pgcc|xlc|xlc_r)
command="$SPACK_CC"
language="C"
comp="CC"
lang_flags=C
;;
- c++|CC|g++|clang++|icpc|pgc++|xlc++)
+ c++|CC|g++|clang++|icpc|pgc++|xlc++|xlc++_r)
command="$SPACK_CXX"
language="C++"
comp="CXX"
lang_flags=CXX
;;
- ftn|f90|fc|f95|gfortran|ifort|pgfortran|xlf90|nagfor)
+ ftn|f90|fc|f95|gfortran|flang|ifort|pgfortran|xlf90|xlf90_r|nagfor)
command="$SPACK_FC"
language="Fortran 90"
comp="FC"
lang_flags=F
;;
- f77|gfortran|ifort|pgfortran|xlf|nagfor|ftn)
+ f77|gfortran|flang|ifort|pgfortran|xlf|xlf_r|nagfor|ftn)
command="$SPACK_F77"
language="Fortran 77"
comp="F77"
@@ -133,7 +134,7 @@ esac
# If any of the arguments below are present, then the mode is vcheck.
# In vcheck mode, nothing is added in terms of extra search paths or
# libraries.
-if [[ -z $mode ]]; then
+if [[ -z $mode ]] || [[ $mode == ld ]]; then
for arg in "$@"; do
if [[ $arg == -v || $arg == -V || $arg == --version || $arg == -dumpversion ]]; then
mode=vcheck
@@ -218,7 +219,7 @@ fi
add_rpaths=true
if [[ ($mode == ld || $mode == ccld) && "$SPACK_SHORT_SPEC" =~ "darwin" ]]; then
for arg in "$@"; do
- if [[ ($arg == -r && $mode == ld) || ($arg == -Wl,-r && $mode == ccld) ]]; then
+ if [[ ($arg == -r && $mode == ld) || ($arg == -r && $mode == ccld) || ($arg == -Wl,-r && $mode == ccld) ]]; then
add_rpaths=false
break
fi
@@ -328,8 +329,10 @@ IFS=':' read -ra extra_rpaths <<< "$SPACK_COMPILER_EXTRA_RPATHS"
for extra_rpath in "${extra_rpaths[@]}"; do
if [[ $mode == ccld ]]; then
$add_rpaths && args=("$rpath$extra_rpath" "${args[@]}")
+ args=("-L$extra_rpath" "${args[@]}")
elif [[ $mode == ld ]]; then
$add_rpaths && args=("-rpath" "$extra_rpath" "${args[@]}")
+ args=("-L$extra_rpath" "${args[@]}")
fi
done
@@ -353,8 +356,8 @@ fi
# Write the input and output commands to debug logs if it's asked for.
#
if [[ $SPACK_DEBUG == TRUE ]]; then
- input_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_SHORT_SPEC.in.log"
- output_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_SHORT_SPEC.out.log"
+ input_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_DEBUG_LOG_ID.in.log"
+ output_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_DEBUG_LOG_ID.out.log"
echo "[$mode] $command $input_command" >> "$input_log"
echo "[$mode] ${full_command[@]}" >> "$output_log"
fi