Restore cc from mainline; clean up some cflags stuff.

This commit is contained in:
Todd Gamblin 2016-05-09 03:37:27 -07:00
parent d392056457
commit 7151fd8836

58
lib/spack/env/cc vendored
View File

@ -50,9 +50,10 @@ SPACK_SHORT_SPEC"
# The compiler input variables are checked for sanity later: # The compiler input variables are checked for sanity later:
# SPACK_CC, SPACK_CXX, SPACK_F77, SPACK_FC # SPACK_CC, SPACK_CXX, SPACK_F77, SPACK_FC
# The default compiler flags are passed from the config files: # The default compiler flags are passed from these variables:
# SPACK_CFLAGS, SPACK_CXXFLAGS, SPACK_FFLAGS, SPACK_LDFLAGS, SPACK_LDLIBS # SPACK_CFLAGS, SPACK_CXXFLAGS, SPACK_FCFLAGS, SPACK_FFLAGS,
# Debug flag is optional; set to true for debug logging: # SPACK_LDFLAGS, SPACK_LDLIBS
# Debug env var is optional; set to true for debug logging:
# SPACK_DEBUG # SPACK_DEBUG
# Test command is used to unit test the compiler script. # Test command is used to unit test the compiler script.
# SPACK_TEST_COMMAND # SPACK_TEST_COMMAND
@ -91,24 +92,24 @@ case "$command" in
cpp) cpp)
mode=cpp mode=cpp
;; ;;
cc|gcc|c89|c99|clang|xlc|icc|pgcc) cc|c89|c99|gcc|clang|icc|pgcc|xlc)
command=("$SPACK_CC") command="$SPACK_CC"
language="C" language="C"
lang_flags=C lang_flags=C
;; ;;
c++|CC|g++|clang++|xlC) c++|CC|g++|clang++|icpc|pgc++|xlc++)
command=("$SPACK_CXX") command="$SPACK_CXX"
language="C++" language="C++"
lang_flags=CXX lang_flags=CXX
;; ;;
f77|xlf) f90|fc|f95|gfortran|ifort|pgfortran|xlf90|nagfor)
command=("$SPACK_F77")
language="Fortran 77"
lang_flags=F
;;
fc|f90|f95|xlf90|gfortran|ifort|pgfortrn|nagfor)
command="$SPACK_FC" command="$SPACK_FC"
language="Fortran 90" language="Fortran 90"
lang_flags=FC
;;
f77|gfortran|ifort|pgfortran|xlf|nagfor)
command="$SPACK_F77"
language="Fortran 77"
lang_flags=F lang_flags=F
;; ;;
ld) ld)
@ -119,8 +120,10 @@ case "$command" in
;; ;;
esac esac
# Check for vcheck mode # If any of the arguments below are present, then the mode is vcheck.
if [ -z "$mode" ]; then # In vcheck mode, nothing is added in terms of extra search paths or
# libraries.
if [[ -z $mode ]]; then
for arg in "$@"; do for arg in "$@"; do
if [[ $arg == -v || $arg == -V || $arg == --version || $arg == -dumpversion ]]; then if [[ $arg == -v || $arg == -V || $arg == --version || $arg == -dumpversion ]]; then
mode=vcheck mode=vcheck
@ -129,7 +132,7 @@ if [ -z "$mode" ]; then
done done
fi fi
# Finish setting the mode # Finish setting up the mode.
if [[ -z $mode ]]; then if [[ -z $mode ]]; then
mode=ccld mode=ccld
for arg in "$@"; do for arg in "$@"; do
@ -179,35 +182,35 @@ fi
input_command="$@" input_command="$@"
args=("$@") args=("$@")
# Prepend cppflags, cflags, cxxflags, fflags, and ldflags # Prepend cppflags, cflags, cxxflags, fcflags, fflags, and ldflags
# Add cppflags
case "$mode" in case "$mode" in
cppas|cc|ccld) cppas|cc|ccld)
# Add cppflags
args=(${SPACK_CPPFLAGS[@]} "${args[@]}") ;; args=(${SPACK_CPPFLAGS[@]} "${args[@]}") ;;
*)
;;
esac esac
# Add compile flags.
case "$mode" in case "$mode" in
cc|ccld) cc|ccld)
# Add c, cxx, and f flags # Add c, cxx, fc, and f flags
case $lang_flags in case $lang_flags in
C) C)
args=(${SPACK_CFLAGS[@]} "${args[@]}") ;; args=(${SPACK_CFLAGS[@]} "${args[@]}") ;;
CXX) CXX)
args=(${SPACK_CXXFLAGS[@]} "${args[@]}") ;; args=(${SPACK_CXXFLAGS[@]} "${args[@]}") ;;
FC)
args=(${SPACK_FCFLAGS[@]} "${args[@]}") ;;
F) F)
args=(${SPACK_FFLAGS[@]} "${args[@]}") ;; args=(${SPACK_FFLAGS[@]} "${args[@]}") ;;
esac esac
;; ;;
*)
;;
esac esac
# Add ldflags
case "$mode" in case "$mode" in
ld|ccld) ld|ccld)
# Add ldflags
args=(${SPACK_CPPFLAGS[@]} "${args[@]}") ;; args=(${SPACK_CPPFLAGS[@]} "${args[@]}") ;;
*)
;;
esac esac
# Read spack dependencies from the path environment variable # Read spack dependencies from the path environment variable
@ -254,8 +257,6 @@ fi
case "$mode" in case "$mode" in
ld|ccld) ld|ccld)
args=("${args[@]}" ${SPACK_LDLIBS[@]}) ;; args=("${args[@]}" ${SPACK_LDLIBS[@]}) ;;
*)
;;
esac esac
# #
@ -287,7 +288,6 @@ for dir in "${env_path[@]}"; do
done done
export PATH export PATH
#ifdef NEW
full_command=("$command" "${args[@]}") full_command=("$command" "${args[@]}")
# In test command mode, write out full command for Spack tests. # In test command mode, write out full command for Spack tests.