forked from goblint/analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·115 lines (107 loc) · 4.07 KB
/
make.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#! /bin/sh
set -e
# generate the version file
scripts/set_version.sh
TARGET=src/goblint
FLAGS="-cflag -annot -tag bin_annot -X webapp -no-links -use-ocamlfind -j 8 -no-log -ocamlopt opt -cflag -g"
OCAMLBUILD=ocamlbuild
ocb() {
$OCAMLBUILD $FLAGS $*
}
setuprest() {
opam update
eval `opam config env`
opam install ocamlfind batteries xml-light ppx_deriving
# opam's cil is too old
opam pin -y add cil "https://github.com/goblint/cil.git"
}
rule() {
case $1 in
clean) rm -rf goblint goblint.byte goblint.ml arinc doclist.odocl src/config.ml $TARGET.ml;
ocb -clean
;;
opt | nat*)
ocb -no-plugin $TARGET.native &&
cp _build/$TARGET.native goblint
;;
debug) ocb -tag debug $TARGET.native &&
cp _build/$TARGET.native goblint
;;
bdebug) ocb -tag debug $TARGET.d.byte &&
cp _build/$TARGET.d.byte goblint.byte
;;
warn) # be pedantic and show all warnings
$OCAMLBUILD $FLAGS -no-plugin -cflags "-w +a" $TARGET.native && # copied b/c passing a quoted argument to a function does not work
cp _build/$TARGET.native goblint
;;
# gprof (run only generates gmon.out). use: gprof goblint
profile) ocb -tag profile $TARGET.p.native &&
cp _build/$TARGET.p.native goblint
;;
# gprof & ocamlprof (run also generates ocamlprof.dump). use: ocamlprof src/goblint.ml
ocamlprof) ocb -ocamlopt ocamloptp $TARGET.p.native &&
cp _build/$TARGET.p.native goblint
;;
byte) ocb $TARGET.byte &&
cp _build/$TARGET.byte goblint.byte
;;
all) ocb $TARGET.native $TARGET.byte &&
cp _build/$TARGET.native goblint &&
cp _build/$TARGET.byte goblint.byte
;;
doc*) rm -rf doc;
ls src/*/*/*.ml src/*/*.ml src/*.ml | egrep -v "apronDomain|poly" | sed 's/.*\/\(.*\)\.ml/\1/' > doclist.odocl;
ocb -ocamldoc ocamldoc -docflags -charset,utf-8,-colorize-code,-keep-code doclist.docdir/index.html;
rm doclist.odocl;
ln -sf _build/doclist.docdir doc
;;
tag*) otags -vi `find src/ -iregex [^.]*\.mli?`;;
arinc) ocb src/mainarinc.native &&
cp _build/src/mainarinc.native arinc
;;
npm) if test ! -e "webapp/package.json"; then
git submodule update --init --recursive webapp
fi
cd webapp && npm install && npm start
;;
jar) if test ! -e "g2html/build.xml"; then
git submodule update --init --recursive g2html
fi
cd g2html && ant jar && cd .. &&
cp g2html/g2html.jar .
;;
depend) echo "No!";;
setup) echo "Make sure you have the following installed: opam >= 1.2.2, m4, patch, autoconf, git"
opam init --comp=4.02.3
setuprest
;;
travis) opam init
setuprest
;;
dev) opam install utop merlin ocp-indent ocp-index
echo "Be sure to adjust your vim/emacs config!"
pushd .git/hooks; ln -s ../../scripts/hooks/pre-commit; popd
echo "Pre-commit hook installed!"
;;
header*) wget http://www.ut.ee/~vesal/linux-headers.tar.xz
tar xf linux-headers.tar.xz
rm linux-headers.tar.xz
;;
poly) echo "open ApronDomain" >> $TARGET.ml
echo "open Poly" >> $TARGET.ml
ocb -no-plugin -package apron -package apron.polkaMPQ -package apron.octD $TARGET.native &&
cp _build/$TARGET.native goblint
;;
*) echo "Unknown action '$1'. Try clean, opt, debug, profile, byte, or doc.";;
esac; }
ls -1 src/*/*.ml | egrep -v "apronDomain|poly" | perl -pe 's/.*\/(.*)\.ml/open \u$1/g' > $TARGET.ml
ls -1 src/*/*/*.ml | perl -pe 's/.*\/(.*)\.ml/open \u$1/g' >> $TARGET.ml
echo "open Maingoblint" >> $TARGET.ml
if [ $# -eq 0 ]; then
rule all
else
while [ $# -gt 0 ]; do
rule $1;
shift
done
fi