-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompile_extracted_examples.sh
executable file
·61 lines (52 loc) · 1.79 KB
/
compile_extracted_examples.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
#!/bin/bash
EXAMPLES_DIR=Source/Examples
EXTRACTION_DIR=/tmp
SOURCE_PREFIX="run_source_"
INTERMEDIATE_PREFIX="run_intermediate_compiled_"
MP_PREFIX="run_compiled_"
TARGET_PREFIX="run_target_compiled_"
if (( $# == 1 )); then
if [[ $1 = "--force-extraction" ]]; then
echo "*** Forcing extraction ***"
touch $EXAMPLES_DIR/*.v
make
fi
fi
pushd $EXTRACTION_DIR/
echo "*** Examples at the source level ***"
for example in $SOURCE_PREFIX*.ml; do
# prepend big int import to each example
echo -e "open Big_int\n$(cat $example)" > $example
filename=$(basename "$example")
filename="${filename%.*}"
echo "Compilation of $example:"
ocamlbuild -libs nums -use-ocamlfind $filename.native
done
echo "*** Examples compiled at the intermediate level ***"
for example in $INTERMEDIATE_PREFIX*.ml; do
# prepend big int import to each example
echo -e "open Big_int\n$(cat $example)" > $example
filename=$(basename "$example")
filename="${filename%.*}"
echo "Compilation of $example:"
ocamlbuild -libs nums -use-ocamlfind $filename.native
done
echo "*** Examples compiled at the micro-policy level ***"
for example in $MP_PREFIX*.ml; do
# prepend big int import to each example
echo -e "open Big_int\n$(cat $example)" > $example
filename=$(basename "$example")
filename="${filename%.*}"
echo "Compilation of $example:"
ocamlbuild -libs nums -use-ocamlfind $filename.native
done
echo "*** Examples compiled at the SFI level ***"
for example in $TARGET_PREFIX*.ml; do
# prepend big int import to each example
echo -e "open Big_int\n$(cat $example)" > $example
filename=$(basename "$example")
filename="${filename%.*}"
echo "Compilation of $example:"
ocamlbuild -libs nums -use-ocamlfind $filename.native
done
popd