mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-05 21:31:36 +00:00
77 lines
1.4 KiB
Bash
Executable File
77 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
while :
|
|
do
|
|
case "$1" in
|
|
"SGX")
|
|
SGX=1
|
|
;;
|
|
"GDB")
|
|
GDB=1
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ -n "$SGX" ] && [ "$SGX" != "0" ]; then
|
|
export SGX=1
|
|
# Sometimes, we end up with a stray SGX_RUN in the environment,
|
|
# which makes the Makefile.Host unhappy
|
|
unset SGX_RUN
|
|
# The interaction of SGX and SGX_RUN is getting pretty unwieldly.
|
|
# We should kill off SGX_RUN. Here, we can get in trouble
|
|
# if the make invocation below gets SGX_RUN via an MAKEFLAGS
|
|
# from a wrapper makefile (e.g., the regression tests)
|
|
unset MAKEFLAGS
|
|
fi
|
|
|
|
RUNTIME_DIR=$(/usr/bin/dirname $(readlink -f ${BASH_SOURCE[0]}))
|
|
PAL_HOST=$(/usr/bin/make --no-print-directory --quiet -f $RUNTIME_DIR/../Pal/src/Makefile.Host print_host 2>&1)
|
|
|
|
MANIFEST=
|
|
PREFIX=
|
|
PAL_CMD=$RUNTIME_DIR/pal-$PAL_HOST
|
|
|
|
if [ "$GDB" == "1" ]; then
|
|
GDB=$RUNTIME_DIR/pal_gdb-$PAL_HOST
|
|
if [ ! -f $GDB ]; then
|
|
GDB="/usr/bin/gdb"
|
|
fi
|
|
fi
|
|
|
|
if [ "$GDB" != "" ] && [ "$GDB" != "0" ]; then
|
|
if [ -n "$INSIDE_EMACS" ]; then
|
|
GDB="$GDB -i=mi"
|
|
fi
|
|
PREFIX="$GDB --args"
|
|
fi
|
|
|
|
if [ "$PERF" == "1" ]; then
|
|
PREFIX="perf stat"
|
|
fi
|
|
|
|
if [ "$MEMUSG" == "1" ]; then
|
|
PREFIX="$RUNTIME_DIR/../Scripts/memusg"
|
|
fi
|
|
|
|
while [ "$1" != "" ];
|
|
do
|
|
if [ "$MANIFEST" == "" ]; then
|
|
MANIFEST=$1
|
|
shift
|
|
continue
|
|
fi
|
|
|
|
break
|
|
done
|
|
|
|
if [ ! -f "$PAL_CMD" ]; then
|
|
echo "$PAL_CMD is not built, or security mode is not supported"
|
|
exit 1
|
|
fi
|
|
|
|
exec $PREFIX $PAL_CMD $MANIFEST "$@"
|