forked from goblint/analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·88 lines (81 loc) · 2.92 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
#! /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 $*
}
rule() {
case $1 in
clean) rm -rf goblint goblint.byte goblint.ml doclist.odocl src/config.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
;;
# 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 | sed 's/.*\/\(.*\)\.ml/\1/' > doclist.odocl;
ocb -ocamldoc ocamldoc.opt -docflags -colorize-code,-keep-code doclist.docdir/index.html;
rm doclist.odocl;
ln -sf _build/doclist.docdir doc
;;
tag*) otags -vi `find src/ -iregex [^.]*\.mli?`;;
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) opam init
opam update
opam switch 4.02.1
eval `opam config env`
opam install ocamlfind batteries xml-light
# opam's cil is too old
opam pin -y add cil https://github.com/kerneis/cil.git#develop
#git submodule update --init --recursive bench
;;
*) 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