-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·93 lines (87 loc) · 2.91 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#! /bin/sh
set -u
cxx_opt='-std=c++20 -Werror -Wall -Wextra -Wno-unused-function -Wcast-align -Wconversion -Wold-style-cast -g -march=native -O3 -fno-exceptions'
opt="-o hammingCoder-$1 $cxx_opt hammingCoder.cc"
polly_opt=
# polly_opt="-mllvm -polly"
# polly_opt="-mllvm -polly -mllvm -polly-vectorizer=stripmine"
clang_opt="$polly_opt -stdlib=libstdc++ -ferror-limit=4 -Wcast-qual -Wundefined-reinterpret-cast -Wvector-conversion $opt"
gcc_opt="-fmax-errors=4 -flto $opt"
case "$1" in
gcc-musl)
x86_64-linux-musl-g++ -static -D HAM_COD_ALG=HammingCoderAlgor::RowsDense -flto -std=c++20 -O3 -fno-exceptions -o "hammingCoder-$1" hammingCoder.cc
;;
clang-callgraph)
clang++ -std=c++20 -g -march=native -O3 -fno-exceptions -stdlib=libstdc++ -emit-llvm -S -o - hammingCoder.cc | opt -dot-callgraph
c++filt < '<stdin>.callgraph.dot' | sed 's,>,\\>,g; s,-\\>,->,g; s,<,\\<,g' | dot -Tsvg > callgraph.svg
rm '<stdin>.callgraph.dot'
;;
clang)
clang++ $clang_opt
;;
clang-RowsDense)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::RowsDense $clang_opt
;;
clang-Cols)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::Cols $clang_opt
;;
clang-ColsSparse)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::ColsSparse $clang_opt
;;
clang-VeryNaive)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::VeryNaive $clang_opt
;;
clang-Dummy)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::Dummy $clang_opt
;;
clang-Rows)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::Rows $clang_opt
;;
clang-RowsSparse)
clang++ -D HAM_COD_ALG=HammingCoderAlgor::RowsSparse $clang_opt
;;
gcc)
g++ $gcc_opt
;;
gcc-RowsDense)
g++ -D HAM_COD_ALG=HammingCoderAlgor::RowsDense $gcc_opt
;;
gcc-Cols)
g++ -D HAM_COD_ALG=HammingCoderAlgor::Cols $gcc_opt
;;
gcc-ColsSparse)
g++ -D HAM_COD_ALG=HammingCoderAlgor::ColsSparse $gcc_opt
;;
gcc-VeryNaive)
g++ -D HAM_COD_ALG=HammingCoderAlgor::VeryNaive $gcc_opt
;;
gcc-Dummy)
g++ -D HAM_COD_ALG=HammingCoderAlgor::Dummy $gcc_opt
;;
gcc-Rows)
g++ -D HAM_COD_ALG=HammingCoderAlgor::Rows $gcc_opt
;;
gcc-RowsSparse)
g++ -D HAM_COD_ALG=HammingCoderAlgor::RowsSparse $gcc_opt
;;
fuzz)
clang++ -fsanitize=fuzzer,address,undefined -fsanitize-trap=undefined -fno-omit-frame-pointer -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $clang_opt
;;
nofuzz-clang)
clang++ -fsanitize=address,undefined -fsanitize-trap=undefined -fno-omit-frame-pointer -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $clang_opt nofuzz.cc
;;
nofuzz-gcc)
g++ -fsanitize=address,undefined -fsanitize-undefined-trap-on-error -fno-omit-frame-pointer -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $gcc_opt nofuzz.cc
;;
nofuzz-gdb-clang)
clang++ -fno-omit-frame-pointer -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $clang_opt nofuzz.cc
;;
nofuzz-gdb-gcc)
g++ -fno-omit-frame-pointer -D FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION $gcc_opt nofuzz.cc
;;
util-random-ascii-bits)
g++ -o util-random-ascii-bits $cxx_opt -flto util/random-ascii-bits.cc
;;
*)
printf "build.sh: unrecognized argument $1 \n" 1>&2
esac