-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (53 loc) · 1.64 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
MAIN = p4cherry
SPEC = watsup
# Compile
.PHONY: build build-p4 build-spectec
EXEMAIN = p4/_build/default/bin/main.exe
EXETEST = p4/_build/default/bin/test.exe
EXESPEC = spectec/spectec/_build/default/src/exe-watsup/main.exe
build: build-p4 build-spectec
build-p4:
rm -f ./$(MAIN)
opam switch 4.14.0
cd p4 && opam exec -- dune build bin/main.exe && echo
ln -f $(EXEMAIN) ./$(MAIN)
build-p4-release:
rm -f ./$(MAIN)
opam switch 4.14.0
cd p4 && opam exec -- dune build --profile release bin/main.exe && echo
ln -f $(EXEMAIN) ./$(MAIN)
build-spectec:
rm -f ./$(SPEC)
opam switch 5.0.0
cd spectec/spectec && opam exec make
ln -f $(EXESPEC) ./$(SPEC)
# Spec
spec: build-spectec
./$(SPEC) --latex spec/*.watsup > spec/spec-gen.include
cd spec && pdflatex spec.tex
echo "Spec generation completed: spec/spec.pdf"
# Format
.PHONY: fmt
fmt:
opam switch 4.14.0
cd p4 && opam exec dune fmt
# Tests
.PHONY: test promote coverage
test:
echo "#### Running (dune runtest)"
opam switch 4.14.0
cd p4 && dune clean && opam exec -- dune runtest && echo OK || (echo "####>" Failure running dune test. && echo "####>" Run \`make promote\` to accept changes in test expectations. && false)
promote:
opam switch 4.14.0
cd p4 && opam exec -- dune promote
coverage:
echo "#### Running (dune runtest --instrument-with bisect_ppx --force)"
opam switch 4.14.0
cd p4 && dune clean && find . -name '*.coverage' | xargs rm -f && opam exec -- dune runtest --instrument-with bisect_ppx --force
cd p4 && bisect-ppx-report html && bisect-ppx-report summary
# Cleanup
.PHONY: clean
clean:
rm -f ./$(MAIN) ./$(SPEC)
cd p4 && dune clean
cd spectec/spectec && dune clean