mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-03 19:42:15 +02:00
eclass/flag-o-matic: Sync with Gentoo
It's from Gentoo commit 74d25eedd9c327fe91048b06ad81b86eb14d9cb7.
This commit is contained in:
parent
b1e2f56094
commit
a3fb510ac9
@ -636,6 +636,11 @@ _test-flag-PROG() {
|
|||||||
|
|
||||||
cmdline_extra+=(-xc)
|
cmdline_extra+=(-xc)
|
||||||
;;
|
;;
|
||||||
|
hip)
|
||||||
|
in_ext='hip'
|
||||||
|
in_src='int main(void) { return 0; }'
|
||||||
|
cmdline_extra+=(-xhip -c)
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
local test_in=${T}/test-flag.${in_ext}
|
local test_in=${T}/test-flag.${in_ext}
|
||||||
local test_out=${T}/test-flag.exe
|
local test_out=${T}/test-flag.exe
|
||||||
@ -707,6 +712,12 @@ test-flag-FC() { _test-flag-PROG FC f95 "$@"; }
|
|||||||
# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
|
# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
|
||||||
test-flag-CCLD() { _test-flag-PROG CC c+ld "$@"; }
|
test-flag-CCLD() { _test-flag-PROG CC c+ld "$@"; }
|
||||||
|
|
||||||
|
# @FUNCTION: test-flag-HIPCXX
|
||||||
|
# @USAGE: <flag>
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Returns shell true if <flag> is supported by the HIP compiler, else returns shell false.
|
||||||
|
test-flag-HIPCXX() { _test-flag-PROG HIPCXX hip "$@"; }
|
||||||
|
|
||||||
# @FUNCTION: test-flags-PROG
|
# @FUNCTION: test-flags-PROG
|
||||||
# @USAGE: <compiler> <flag> [more flags...]
|
# @USAGE: <compiler> <flag> [more flags...]
|
||||||
# @INTERNAL
|
# @INTERNAL
|
||||||
@ -788,6 +799,12 @@ test-flags-FC() { _test-flags-PROG FC "$@"; }
|
|||||||
# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false.
|
# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false.
|
||||||
test-flags-CCLD() { _test-flags-PROG CCLD "$@"; }
|
test-flags-CCLD() { _test-flags-PROG CCLD "$@"; }
|
||||||
|
|
||||||
|
# @FUNCTION: test-flags-HIPCXX
|
||||||
|
# @USAGE: <flags>
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Returns shell true if <flags> are supported by the HIP compiler and default linker, else returns shell false.
|
||||||
|
test-flags-HIPCXX() { _test-flags-PROG HIPCXX "$@"; }
|
||||||
|
|
||||||
# @FUNCTION: test-flags
|
# @FUNCTION: test-flags
|
||||||
# @USAGE: <flags>
|
# @USAGE: <flags>
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -810,7 +827,7 @@ test_version_info() {
|
|||||||
|
|
||||||
# @FUNCTION: strip-unsupported-flags
|
# @FUNCTION: strip-unsupported-flags
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain.
|
# Strip {C,CXX,F,FC,HIP}FLAGS of any flags not supported by the active toolchain.
|
||||||
strip-unsupported-flags() {
|
strip-unsupported-flags() {
|
||||||
[[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments"
|
[[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments"
|
||||||
export CFLAGS=$(test-flags-CC ${CFLAGS})
|
export CFLAGS=$(test-flags-CC ${CFLAGS})
|
||||||
@ -818,6 +835,7 @@ strip-unsupported-flags() {
|
|||||||
export FFLAGS=$(test-flags-F77 ${FFLAGS})
|
export FFLAGS=$(test-flags-F77 ${FFLAGS})
|
||||||
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
|
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
|
||||||
export LDFLAGS=$(test-flags-CCLD ${LDFLAGS})
|
export LDFLAGS=$(test-flags-CCLD ${LDFLAGS})
|
||||||
|
export HIPFLAGS=$(test-flags-HIPCXX ${HIPFLAGS})
|
||||||
}
|
}
|
||||||
|
|
||||||
# @FUNCTION: get-flag
|
# @FUNCTION: get-flag
|
||||||
@ -1008,6 +1026,12 @@ test-compile() {
|
|||||||
args+=(${FCFLAGS[@]} ${LDFLAGS[@]} -xf95)
|
args+=(${FCFLAGS[@]} ${LDFLAGS[@]} -xf95)
|
||||||
libs+=(${LIBS[@]})
|
libs+=(${LIBS[@]})
|
||||||
;;
|
;;
|
||||||
|
hip)
|
||||||
|
compiler="$(tc-getHIPCXX)"
|
||||||
|
filename_in="${T}/test.hip"
|
||||||
|
filename_out="${T}/test.o"
|
||||||
|
args+=(${CFLAGS[@]} -xhip -c)
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
die "Unknown compiled language ${lang}"
|
die "Unknown compiled language ${lang}"
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user