Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,37 @@ mode=""
vdep=""
lang_flags=""
debug_flags=""
command="${0##*/}"
comp="CC"
vcheck_flags=""

command_from_argv0="${0##*/}"
command="$command_from_argv0"

_command_from_flags() {
while [ $# -ne 0 ]; do
arg="$1"
shift
case "$arg" in
-x|--language)
_lang="$1"
shift ;;
-x*)
_lang="${arg#-x}" ;;
--language=*)
_lang="${arg#--language=}" ;;
*) continue ;;
esac
done

case "$_lang" in
c) command=cc ;;
c++|f77|f95|hip) command="$_lang" ;;
*) command="$command_from_argv0" ;; # drop unknown languages
esac
}

_command_from_flags "$@"

case "$command" in
cpp)
mode=cpp
Expand Down Expand Up @@ -339,6 +367,14 @@ case "$command" in
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_FFLAGS}"
;;
hip|spackhip)
command="$SPACK_HIPCXX"
vdep="spack-hip"
comp="HIPCXX"
lang_flags=HIP
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_HIPCXXFLAGS}"
;;
ld|ld.gold|ld.lld)
mode=ld
if [ -z "$SPACK_CC_RPATH_ARG" ]; then
Expand Down