forked from hacl-star/hacl-star
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.prepare
95 lines (79 loc) · 2.88 KB
/
Makefile.prepare
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
HACL_HOME ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
Z3_HOME ?= $(HACL_HOME)/dependencies/z3
FSTAR_HOME ?= $(HACL_HOME)/dependencies/FStar
KREMLIN_HOME ?= $(HACL_HOME)/dependencies/kremlin
#
# Installation helper
#
UNAME := $(shell uname)
ifeq ($(OS),Windows_NT)
VERSION_OCAML=4.03.2
VERSION_Z3=4.5.1.1f29cebd4df6-x64-win
endif
ifeq ($(UNAME),Darwin)
VERSION_OCAML=4.04.2
VERSION_Z3=4.5.1.1f29cebd4df6-x64-osx-10.11.6
endif
ifeq ($(UNAME),Linux)
VERSION_OCAML=4.05.0
VERSION_Z3=4.5.1.1f29cebd4df6-x64-ubuntu-14.04
endif
VERSION_KREMLIN=4064311aba2c365c7f229f7c5d2118648d29cb41
.prepare:
mkdir -p $(HACL_HOME)/dependencies
prepare: .prepare
$(MAKE) prepare-ocaml
$(MAKE) prepare-z3
$(MAKE) prepare-fstar
$(MAKE) prepare-kremlin
$(MAKE) .prepare-ocaml-display-done
$(MAKE) .prepare-z3-display-done
$(MAKE) .prepare-fstar-display-done
$(MAKE) .prepare-kremlin-display-done
prepare-ocaml: .prepare
@echo "# Installing OCaml packages required by F*"
opam switch $(VERSION_OCAML)
opam install ocamlfind batteries sqlite3 fileutils stdint zarith yojson pprint menhir ulex
@echo "# Installing OCaml packages required by KreMLin"
opam install ppx_deriving_yojson zarith pprint menhir process fix wasm
prepare-z3: .prepare
@echo "# Installing Z3 required by F*"
cd $(HACL_HOME)/dependencies && \
rm -rf $(HACL_HOME)/dependencies/z3 && \
rm -rf $(HACL_HOME)/dependencies/z3-$(VERSION_Z3) && \
wget https://github.com/FStarLang/binaries/raw/master/z3-tested/z3-$(VERSION_Z3).zip && \
unzip z3-$(VERSION_Z3).zip && \
rm -rf z3-$(VERSION_Z3).zip && \
mv z3-$(VERSION_Z3) $(Z3_HOME)
$(MAKE) .prepare-z3-display-done
prepare-fstar: .prepare
@echo "# Installing F*"
cd $(HACL_HOME)/dependencies && \
rm -rf $(HACL_HOME)/dependencies/FStar && \
git clone https://github.com/FStarLang/FStar.git
cd $(HACL_HOME)/dependencies/FStar && \
git checkout stable && \
opam config exec -- make -C src/ocaml-output -j && \
opam config exec -- make -C ulib/ml
$(MAKE) .prepare-fstar-display-done
prepare-kremlin: .prepare
@echo "# Installing Kremlin"
cd $(HACL_HOME)/dependencies && \
rm -rf $(HACL_HOME)/dependencies/kremlin && \
git clone https://github.com/FStarLang/kremlin.git
cd $(HACL_HOME)/dependencies/kremlin && \
git checkout $(VERSION_KREMLIN) && \
opam config exec -- make
$(MAKE) .prepare-kremlin-display-done
prepare-clean:
@echo "# Removing all dependencies"
rm -rf dependencies
@echo "Done ! Do not forget to remove your environnement variables"
.prepare-ocaml-display-done:
@echo "Done: Installing OCaml"
.prepare-kremlin-display-done:
@echo "Done (Install KreMLin) !\nPlease set an environnment variable KREMLIN_HOME to\n'$(KREMLIN_HOME)'\n"
.prepare-fstar-display-done:
@echo "Done (Install FStar) !\nPlease set an environnment variable FSTAR_HOME to\n'$(FSTAR_HOME)'\n"
.prepare-z3-display-done:
@echo "Done (Install Z3) !\nPlease add the Z3 executable to your PATH\n"