-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
100 lines (76 loc) · 2.63 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
all: test
test: dist/test.exe
$<
# Boilerplate
# -----------
include Makefile.include
EXCLUDE_MODULES=Spec.Old Impl.Old
FST_FILES=$(filter-out $(addprefix src/QUIC.,$(addsuffix .fst,$(EXCLUDE_MODULES)) $(addsuffix .fsti,$(EXCLUDE_MODULES))),$(wildcard src/*.fst) $(wildcard src/*.fsti)) test/QUICTest.fst
ifndef NODEPEND
ifndef MAKE_RESTARTS
.depend: .FORCE
@mkdir -p obj
@$(FSTAR) --dep full $(FST_FILES) > $@
.PHONY: .FORCE
.FORCE:
endif
endif
include .depend
clean-dist:
rm -rf dist
clean: clean-dist
rm -rf obj .depend
# Verification
# ------------
%.checked:
$(FSTAR) --hint_file hints/$(notdir $*).hints $(notdir $*) && touch -c $@
%.krml:
$(FSTAR) --codegen krml \
--extract_module $(basename $(notdir $(subst .checked,,$<))) \
$(notdir $(subst .checked,,$<))
verify: $(ALL_CHECKED_FILES)
# Karamel
# -------
KRML=$(KRML_HOME)/krml
obj/krml.rsp: $(filter-out %/prims.krml,$(ALL_KRML_FILES))
for f in $^ ; do echo $$f ; done > $@
dist/Makefile.basic: obj/krml.rsp
$(KRML) $(KOPTS) -library EverCrypt,EverCrypt.* @$^ -tmpdir dist -skip-compilation \
-minimal \
-header noheader.txt \
-add-include '"krml/internal/target.h"' \
-add-include '"krml/internal/types.h"' \
-add-include '"krml/lowstar_endianness.h"' \
-add-include '<stdint.h>' \
-add-include '<stdbool.h>' \
-add-include '<string.h>' \
-library 'Vale.Stdcalls.*' \
-no-prefix 'Vale.Stdcalls.*' \
-static-header 'Vale.Inline.*' \
-library 'Vale.Inline.X64.Fadd_inline' \
-library 'Vale.Inline.X64.Fmul_inline' \
-library 'Vale.Inline.X64.Fswap_inline' \
-library 'Vale.Inline.X64.Fsqr_inline' \
-no-prefix 'Vale.Inline.X64.Fadd_inline' \
-no-prefix 'Vale.Inline.X64.Fmul_inline' \
-no-prefix 'Vale.Inline.X64.Fswap_inline' \
-no-prefix 'Vale.Inline.X64.Fsqr_inline' \
-fparentheses \
-o libeverquic.a \
-bundle LowParse.* \
-bundle LowStar.* \
-bundle Prims,C.Failure,C,C.String,C.Loops,Spec.Loops,C.Endianness,FStar.*[rename=EverQuic_Krmllib] \
-bundle 'Meta.*,Hacl.*,Vale.*,Spec.*,Lib.*,EverCrypt,EverCrypt.*,NotEverCrypt.*[rename=EverQuic_EverCrypt]' \
-bundle Model.* \
-bundle Mem \
-bundle 'QUIC.State+QUIC.Impl.Header.Base=QUIC.\*[rename=EverQuic,rename-prefix]'
dist/libeverquic.a: dist/Makefile.basic
$(MAKE) -C dist -f Makefile.basic
.PHONY: clean clean-dist verify
# Tests
# -----
CFLAGS+=-I$(realpath .)/dist -I$(realpath $(KRML_HOME))/include -I$(realpath $(KRML_HOME))/krmllib/dist/minimal
export CFLAGS
test/main.o: dist/Makefile.basic
dist/test.exe: test/main.o dist/libeverquic.a $(HACL_HOME)/dist/gcc-compatible/libevercrypt.a $(KRML_HOME)/krmllib/dist/generic/libkrmllib.a
$(CC) $^ -o $@