Restructure clang-target-wrapper.sh to set one flag per line

This commit is contained in:
Martin Storsjö committed 2018-10-02 23:38:19 +03:00
1 parent 7f98eea889
commit fb5c95589c
1 file changed
+20 -11
+20 -11
View File
@@ -2,12 +2,20 @@
DIR="$(cd "$(dirname "$0")" && pwd)" DIR="$(cd "$(dirname "$0")" && pwd)"
TARGET="$(basename $0 | sed 's/-[^-]*$//')" TARGET="$(basename $0 | sed 's/-[^-]*$//')"
EXE=$(basename $0 | sed 's/.*-\([^-]*\)/\1/') EXE=$(basename $0 | sed 's/.*-\([^-]*\)/\1/')
ARCH=$(echo $TARGET | sed 's/-.*//')
# Allow setting e.g. CCACHE=1 to wrap all building in ccache.
if [ -n "$CCACHE" ]; then
CCACHE=ccache
fi
CLANG="$DIR/clang"
FLAGS=""
case $EXE in case $EXE in
clang++|g++) clang++|g++)
DRIVER_MODE=--driver-mode=g++ FLAGS="$FLAGS --driver-mode=g++"
;; ;;
esac esac
ARCH=$(echo $TARGET | sed 's/-.*//')
case $ARCH in case $ARCH in
i686) i686)
# Dwarf is the default for i686, but libunwind sometimes fails to # Dwarf is the default for i686, but libunwind sometimes fails to
@@ -19,23 +27,24 @@ i686)
# some handling relating to this dwarf opcode, which made # some handling relating to this dwarf opcode, which made
# test/hello-exception.cpp work properly, but apparently there are # test/hello-exception.cpp work properly, but apparently there are
# still issues with it). # still issues with it).
ARCH_FLAGS=-fsjlj-exceptions FLAGS="$FLAGS -fsjlj-exceptions"
;; ;;
x86_64) x86_64)
# SEH is the default here. # SEH is the default here.
ARCH_FLAGS=
;; ;;
armv7) armv7)
# Dwarf is the default here. # Dwarf is the default here.
ARCH_FLAGS=
;; ;;
aarch64) aarch64)
# Dwarf is the default here. # Dwarf is the default here.
ARCH_FLAGS=
;; ;;
esac esac
# Allow setting e.g. CCACHE=1 to wrap all building in ccache.
if [ -n "$CCACHE" ]; then FLAGS="$FLAGS -target $TARGET"
CCACHE=ccache FLAGS="$FLAGS -rtlib=compiler-rt"
fi FLAGS="$FLAGS -stdlib=libc++"
$CCACHE $DIR/clang $DRIVER_MODE -target $TARGET -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld -fuse-cxa-atexit $ARCH_FLAGS -Qunused-arguments "$@" FLAGS="$FLAGS -fuse-ld=lld"
FLAGS="$FLAGS -fuse-cxa-atexit"
FLAGS="$FLAGS -Qunused-arguments"
$CCACHE $CLANG $FLAGS "$@"