-
Notifications
You must be signed in to change notification settings - Fork 234
/
Makefile
205 lines (166 loc) · 5.4 KB
/
Makefile
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
include .common.mk
.PHONY: all
all: build-and-verify-ulib
DUNE_SNAPSHOT ?= $(call maybe_cygwin_path,$(CURDIR)/ocaml)
# The directory where we install files when doing "make install".
# Overridden via the command-line by the OPAM invocation.
PREFIX ?= /usr/local
# On Cygwin, the `--prefix` option to dune only
# supports Windows paths.
FSTAR_CURDIR=$(call maybe_cygwin_path,$(CURDIR))
FSTAR_BUILD_PROFILE ?= release
.PHONY: fstar
fstar:
$(Q)cp version.txt $(DUNE_SNAPSHOT)/
@# Call Dune to build the snapshot.
@echo " DUNE BUILD"
$(Q)cd $(DUNE_SNAPSHOT) && dune build --profile=$(FSTAR_BUILD_PROFILE)
@echo " DUNE INSTALL"
$(Q)cd $(DUNE_SNAPSHOT) && dune install --profile=$(FSTAR_BUILD_PROFILE) --prefix=$(FSTAR_CURDIR)
.PHONY: verify-ulib
verify-ulib:
+$(Q)$(MAKE) -C ulib
.PHONY: build-and-verify-ulib
build-and-verify-ulib: fstar
+$(Q)$(MAKE) verify-ulib
# Removes all generated files (including the whole generated snapshot,
# and .checked files), except the object files, so that the snapshot
# can be rebuilt with an existing fstar.exe
.PHONY: clean-snapshot
clean-snapshot: clean-intermediate
$(call msg, "CLEAN SNAPSHOT")
$(Q)cd $(DUNE_SNAPSHOT) && { dune clean || true ; }
$(Q)rm -rf $(DUNE_SNAPSHOT)/fstar-lib/generated/*
$(Q)rm -f src/ocaml-output/fstarc/*
$(Q)rm -f src/ocaml-output/fstarlib/*
.PHONY: dune-snapshot
dune-snapshot:
+$(Q)$(MAKE) -C src/ocaml-output dune-snapshot
# This rule is not incremental, by design.
.PHONY: full-bootstrap
full-bootstrap:
+$(Q)$(MAKE) fstar
+$(Q)$(MAKE) clean-snapshot
+$(Q)$(MAKE) bootstrap
.PHONY: bootstrap
bootstrap:
+$(Q)$(MAKE) dune-snapshot
+$(Q)$(MAKE) fstar
# This is a faster version of bootstrap, since it does not use dune
# to install the binary and libraries, and instead just copies the binary
# mannualy. HOWEVER, note that this means plugins will not work well,
# since they are compiled against the objects in bin/, which will become
# stale if this rule is used. Using bootstrap is usually safer.
.PHONY: boot
boot:
+$(Q)$(MAKE) dune-snapshot
$(Q)cp version.txt $(DUNE_SNAPSHOT)/
@# Call Dune to build the snapshot.
$(call msg, "DUNE BUILD")
$(Q)cd $(DUNE_SNAPSHOT) && dune build --profile release
$(call msg, "RAW INSTALL")
$(Q)install ocaml/_build/default/fstar/main.exe $(FSTAR_CURDIR)/bin/fstar.exe
.PHONY: install
install:
+$(Q)$(MAKE) -C src/ocaml-output install
# The `uninstall` rule is only necessary for users who manually ran
# `make install`. It is not needed if F* was installed with opam,
# since `opam remove` can uninstall packages automatically with its
# own way.
.PHONY: uninstall
uninstall:
rm -rf \
$(PREFIX)/lib/fstar \
$(PREFIX)/bin/fstar_tests.exe \
$(PREFIX)/bin/fstar.exe \
$(PREFIX)/share/fstar
.PHONY: package
package: all
+$(Q)$(MAKE) -C src/ocaml-output package
# Removes everything created by `make all`. MUST NOT be used when
# bootstrapping.
.PHONY: clean
clean: clean-intermediate
$(call msg, "CLEAN")
$(Q)cd $(DUNE_SNAPSHOT) && { dune clean || true ; }
# Removes all .checked files and other intermediate files
# Does not remove the object files from the dune snapshot.
.PHONY: clean-intermediate
clean-intermediate:
+$(Q)$(MAKE) -C ulib clean
+$(Q)$(MAKE) -C src clean
# Regenerate all hints for the standard library and regression test suite
.PHONY: hints
hints:
+$(Q)OTHERFLAGS="${OTHERFLAGS} --record_hints" $(MAKE) -C ulib/
+$(Q)OTHERFLAGS="${OTHERFLAGS} --record_hints" $(MAKE) ci-uregressions ci-ulib-extra
.PHONY: bench
bench:
./bin/run_benchmark.sh
# Regenerate and accept expected output tests. Should be manually
# reviewed before checking in.
.PHONY: output
output: \
output--examples \
output--tests
.PHONY: output--%
output--%:
+$(Q)$(MAKE) -C $* accept
# This rule is meant to mimic what the docker based CI does, but it
# is not perfect. In particular it will not look for a diff on the
# snapshot, nor run the build-standalone script.
.PHONY: ci
ci:
+$(Q)FSTAR_HOME=$(CURDIR) $(MAKE) ci-pre
+$(Q)FSTAR_HOME=$(CURDIR) $(MAKE) ci-post
# This rule runs a CI job in a local container, exactly like is done for
# CI.
.PHONY: docker-ci
docker-ci:
docker build -f .docker/standalone.Dockerfile \
--build-arg CI_THREADS=$(shell nproc) \
--build-arg FSTAR_CI_NO_GITDIFF=1 \
.
.PHONY: ci-pre
ci-pre: ci-rebootstrap
.PHONY: ci-rebootstrap
ci-rebootstrap:
+$(Q)$(MAKE) full-bootstrap FSTAR_BUILD_PROFILE=test
.PHONY: ci-ocaml-test
ci-ocaml-test:
+$(Q)$(MAKE) -C src ocaml-unit-tests
.PHONY: ci-ulib-extra
ci-ulib-extra:
+$(Q)$(MAKE) -C ulib extra
.PHONY: ci-ulib-in-fsharp
ci-ulib-in-fsharp:
+$(Q)$(MAKE) -C ulib ulib-in-fsharp
.PHONY: ci-post
ci-post: \
ci-ulib-in-fsharp \
ci-ocaml-test \
ci-uregressions \
$(if $(FSTAR_CI_TEST_KARAMEL),ci-karamel-test,)
.PHONY: ci-uregressions
ci-uregressions:
+$(Q)$(MAKE) -C src uregressions
.PHONY: ci-karamel-test
ci-karamel-test: ci-krmllib
+$(Q)$(MAKE) -C examples -f karamel.Makefile
# krmllib needs FStar.ModifiesGen already checked, so we add the dependency on
# ulib-extra here. This is possibly spurious and fixable by tweaking krml's makefiles.
.PHONY: ci-krmllib
ci-krmllib: ci-ulib-extra
+$(Q)OTHERFLAGS="${OTHERFLAGS} --admit_smt_queries true" $(MAKE) -C $(KRML_HOME)/krmllib
# Shortcuts:
.PHONY: 1 2 3
1: fstar
# This is a hacky rule to bootstrap the compiler, and not
# the library, more quickly.
2:
+$(Q)$(MAKE) -C src ocaml
+$(Q)$(MAKE) -C src/ocaml-output overlay-snapshots
+$(Q)$(MAKE) fstar
3:
+$(Q)$(MAKE) 1
+$(Q)$(MAKE) 2