-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract.in
executable file
·70 lines (50 loc) · 1.6 KB
/
extract.in
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
#!/bin/sh
# Rainbow, a termination proof certification tool
# See the COPYRIGHTS and LICENSE files.
#
# - Frederic Blanqui, 2009-11-06
prog=`basename $0`
dir=`dirname $0`
usage () { echo "usage: $prog [-h]"; }
help () {
cat <<EOF
Extract OCaml files from the CoLoR library and compile them.
Options:
-h Provide this help and exit
EOF
}
args () { echo 'error: wrong number of arguments'; usage; exit 1; }
case "$1" in
-h|--help) usage; echo; help; exit 0;;
esac
if test $# -ne 0; then args; fi
echo remove tmp directory ...
rm -rf tmp
echo create tmp directory ...
mkdir tmp
echo 'put nothing in this directory since it can be erased' > tmp/README
echo extract OCaml files from CoLoR ...
coqtop -q __COQ_OPTIONS__ -I coq -batch -l extraction.v || exit $?
# TEST
echo replace tmp/String0.ml[i] by String0.ml[i] ...
cp -f String0.ml String0.mli tmp
#echo patch tmp/Int.ml[i] ...
#sed -i '1i type ocaml_int = int' tmp/Int.ml
#sed -i -e 's|val i2z : t -> int|val i2z : t -> ocaml_int|' tmp/Int.ml
#sed -i '1i type ocaml_int = int' tmp/Int.mli
#sed -i -e 's|val i2z : t -> int|val i2z : t -> ocaml_int|' tmp/Int.mli
if test ! -f order_deps
then
echo compile order_deps ...
ocamlopt -o order_deps str.cmxa order_deps.ml || exit $?
fi
# go into tmp directory
cd tmp
echo compute dependencies ...
ocamldep *.ml *.mli > .depend.color || exit $?
files=`ls *.ml | sed -e 's|.ml||g'`
files=`sed -e 's|.cm[iox]||g' .depend.color | ../order_deps $files`
echo create Makefile ...
sed -e "s|FILES :=|FILES := $files|" ../Makefile.color > Makefile || exit $?
echo compile extracted library ...
make -r -j 3 color.cma color.cmxa