-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·124 lines (116 loc) · 5.37 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
115
116
117
118
119
120
121
122
123
#! /bin/bash
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
EXCLUDE="_build|goblint.ml|apronDomain|poly"
ocb() {
command -v opam >/dev/null 2>&1 && eval $(opam config env)
$OCAMLBUILD $FLAGS $*
}
ocaml_version="4.06.0"
opam_build() {
eval $(opam config env)
opam update
opam install ocamlfind batteries xml-light ppx_distr_guards ppx_monadic ppx_import ppx_deriving ppx_deriving_yojson
# opam install camlp4 mongo # camlp4 needed for mongo
# 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 arinc doclist.odocl $TARGET.ml;
ocb -clean
;;
opt | nat*)
ocb -no-plugin $TARGET.native &&
cp _build/$TARGET.native goblint
;;
debug) 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
;;
doc*) rm -rf doc;
ls src/**/*.ml | egrep -v $EXCLUDE | 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?`;;
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
;;
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) echo "Make sure you have the following installed: javac, ant"
if test ! -e "g2html/build.xml"; then
git submodule update --init --recursive g2html
fi
cd g2html && ant jar && cd .. &&
cp g2html/g2html.jar .
;;
dep*) OPAMYES=1 opam_build;;
setup) echo "Make sure you have the following installed: opam >= 1.2.2, m4, patch, autoconf, git"
echo "For the --html output you also need: javac, ant, dot (graphviz)"
echo "For running the regression tests you also need: ruby, gem, curl"
opam init --comp=$ocaml_version
opam switch $ocaml_version # in case opam was already initialized
opam_build
;;
dev) echo "Installing opam packages for development..."
opam install utop merlin ocp-indent
echo "Be sure to adjust your vim/emacs config!"
echo "Installing Pre-commit hook..."
cd .git/hooks; ln -s ../../scripts/hooks/pre-commit; cd -
echo "Installing gem parallel (not needed for ./scripts/update_suite.rb -s)"
sudo gem install parallel
;;
watch) fswatch --event Updated -e $TARGET.ml src/ | xargs -n1 -I{} make
;;
header*) curl -L -O https://github.com/goblint/linux-headers/archive/master.tar.gz
tar xf master.tar.gz && rm master.tar.gz
rm -rf linux-headers && mv linux-headers-master linux-headers
cp linux-headers/include/linux/compiler-gcc5.h linux-headers/include/linux/compiler-gcc6.h
cp linux-headers/include/linux/compiler-gcc5.h linux-headers/include/linux/compiler-gcc7.h
cp linux-headers/include/linux/compiler-gcc5.h linux-headers/include/linux/compiler-gcc8.h
cp linux-headers/include/linux/compiler-gcc5.h linux-headers/include/linux/compiler-gcc9.h
;;
test) ./scripts/update_suite.rb;; # run regression tests
testci) ruby scripts/update_suite.rb -s -d;;
unit) ocamlbuild -use-ocamlfind unittest/mainTest.native && ./mainTest.native;;
server) rsync -avz --delete --exclude='/.git' --exclude='server.sh' --exclude-from="$(git ls-files --exclude-standard -oi --directory > /tmp/excludes; echo /tmp/excludes)" . serverseidl6.informatik.tu-muenchen.de:~/analyzer2
ssh serverseidl6.informatik.tu-muenchen.de 'cd ~/analyzer2; make nat && make test'
;;
*) echo "Unknown action '$1'. Try clean, opt, debug, profile, byte, or doc.";;
esac; }
ls -1 src/**/*.ml | egrep -v $EXCLUDE | perl -pe 's/.*\/(.*)\.ml/open \u$1/g' > $TARGET.ml
echo "open Maingoblint" >> $TARGET.ml
if [ $# -eq 0 ]; then
rule nat
else
while [ $# -gt 0 ]; do
rule $1;
shift
done
fi