1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # build/cpp.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
|
11 |
|
12 | source build/common.sh # CLANGXX
|
13 |
|
14 | compile-quickly() {
|
15 | ### For the fast possible development experience
|
16 |
|
17 | if test -f "$CLANGXX"; then
|
18 | ninja _bin/clang-dbg/oils-for-unix
|
19 | else
|
20 | echo ""
|
21 | echo " Error: Unable to locate clang at ($CLANGXX)"
|
22 | echo ""
|
23 | echo " To install clang at the specified path, run the following commands:"
|
24 | echo ""
|
25 | echo " deps/from-binary.sh download-clang"
|
26 | echo " deps/from-binary.sh extract-clang"
|
27 | echo ""
|
28 | fi
|
29 | }
|
30 |
|
31 | compiler-trace-build() {
|
32 | ### Output _build/obj/clang-dbg/*.json files
|
33 |
|
34 | local variant=${1:-dbg}
|
35 |
|
36 | # Only clang supports -ftime-trace
|
37 | CXXFLAGS='-ftime-trace' ninja _bin/clang-$variant/oils-for-unix
|
38 | }
|
39 |
|
40 | "$@"
|