This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·73 lines (64 loc) · 1.53 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
#!/bin/bash
args="$@"
EXTRAFLAGS="-std=c99"
LIBLOC="$HOME/homebrew/lib"
INCLOC="$HOME/homebrew/include"
BINLOC=""
if [ ! -d "$LIBLOC" ]; then
LIBLOC="/usr/local/lib"
fi
if [ ! -d "$INCLOC" ]; then
INCLOC="/usr/local/include"
fi
os=`uname`
case $os in
Linux)
# this is to stop GCC from complaining that
# strlen isn't defined in string.h on my
# chromebook.
EXTRAFLAGS="-std=gnu99"
;;
*)
;;
esac
if [ $# -gt 0 ]
then
case $1 in
softdebug)
# this mode enables symbols, but does
# not enable debug print, to cut down
# on noise
echo "[soft debugging enabled]"
EXTRAFLAGS="-std=c99 -g" ;;
debug)
echo "[debugging enabled]"
EXTRAFLAGS="-std=c99 -g -DDEBUG" ;;
lax)
echo "[lax strict mode]"
EXTRAFLAGS="-std=c99 -Wall"
;;
strict)
echo "[strict mode]"
EXTRAFLAGS="-std=c99 -Wall -Werror"
;;
install)
echo "[installing]"
if [ $# -gt 1 ]
then
BINLOC=$2
else
BINLOC="$HOME/opt/bin"
fi
;;
*)
;;
esac
fi
echo "building carML/c carmlc.c"
cc $EXTRAFLAGS -o carmlc ./src/carmlc.c ./src/self_tco.c -L $LIBLOC -I $INCLOC -I ./src -lgc && echo "[build success]" || echo "[build failed]"
if [ -d "$BINLOC" ]
then
echo "installing to" $BINLOC
strip carmlc
cp carmlc $BINLOC
fi