-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·37 lines (29 loc) · 817 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·37 lines (29 loc) · 817 Bytes
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
#!/bin/bash
set -e
# You can explicitly set the C compiler by providing a CC environment variable.
# This also works inline: CC=clang ./build.sh
CC="${CC:-cc}"
RELEASE="${RELEASE:-}"
FLAGS="-std=c11 -g -pthread -Wno-incompatible-pointer-types "
if [[ $($CC -v 2>&1) == *"clang version"* ]]
then
FLAGS="$FLAGS $SANITIZE -Wno-tautological-constant-out-of-range-compare -Wno-initializer-overrides"
fi
rm -rf build
mkdir -p build
cd build
$CC $FLAGS ../meta.c -o meta -lm -ldl
./meta
cd ..
if [[ $RELEASE ]]
then
FLAGS="$FLAGS -O3 -DNDEBUG"
else
FLAGS="$FLAGS -O0"
if [[ $($CC -v 2>&1) == *"clang version"* ]]
then
FLAGS="$FLAGS -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common"
fi
fi
$CC $FLAGS mass.c -o build/mass -lm -ldl
$CC $FLAGS source_spec.c -o build/source_spec -lm -ldl