1#!/bin/bash
2
3# Build Skia with one of Clang's many sanitizers.
4#
5# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make...]
6#
7# This script assumes the use of Clang >=3.2.
8#
9# For more information, see:
10#   http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
11
12set -e
13
14sanitizer=$1
15shift
16args="$@"
17
18export CC="$(which clang)"
19export CXX="$(which clang++)"
20
21if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]]; then
22  echo "Couldn't find Clang on this machine!"
23  exit 1
24fi
25
26echo "CC=$CC"
27echo "CXX=$CXX"
28$CC --version
29
30export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}"
31make ${args}
32