-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
84 lines (64 loc) · 1.96 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
PREFIX ?= /usr/local/bin
VULT_SRC := $(shell find src -type f -name "*.ml") $(shell find test -type f -name "*.ml")
OCB = ocamlbuild -j 4 -use-ocamlfind
ifeq (, $(shell which ocamlformat))
OCAMLFORMAT = echo
else
OCAMLFORMAT = ocamlformat
endif
ifeq (, $(shell which ocp-indent))
OCPINDENT = echo
else
OCPINDENT = ocp-indent
endif
compiler: version format
$(OCB) src/vultc.native src/vultc.byte
format: $(VULT_SRC)
@$(OCAMLFORMAT) -i --enable-outside-detected-project $(VULT_SRC)
@$(OCPINDENT) -i $(VULT_SRC)
js: compiler
$(OCB) src/js/vultlib.byte
js_of_ocaml --target-env=nodejs vultlib.byte
jscompiler:
$(OCB) src/js/vultcjs.byte
js_of_ocaml --target-env=nodejs --custom-header="#!/usr/bin/env node" vultcjs.byte -o vultc.js
chmod +x vultc.js
web:
$(OCB) src/js/vultweb.byte
js_of_ocaml --target-env=browser vultweb.byte
vultc_h: web
$(OCB) src/util/make_h.native
./make_h.native vultweb.js vultc.h
test: compiler jscompiler
$(OCB) test/test.native
./test.native -runner sequential -shards 1
perf:
$(OCB) test/perf.native
./perf.native
test-fast:
$(OCB) test/test.native
./test.native -runner sequential -shards 1 -internal true
test-update:
$(OCB) test/test.native
./test.native -runner sequential -update true -shards 1 -internal true
coverage: compiler jscompiler
$(OCB) -clean
BISECT_COVERAGE=YES $(OCB) test/test.native
BISECT_COVERAGE=YES $(OCB) src/vultc.native
BISECT_COVERAGE=YES $(OCB) test/perf.native
BISECT_FILE=_build/coverage ./test.native -runner sequential -shards 1
BISECT_FILE=_build/coverage ./perf.native
bisect-ppx-report send-to Coveralls --source-path _build
version :
@echo "let version = \"" > src/version.ml
@git describe --tags --abbrev=0 --always >> src/version.ml
@echo "\"" >> src/version.ml
all: compiler js test web vultc_h jscompiler
clean:
$(OCB) -clean
rm -f vultc.js vultweb.js vultlib.js vultc.h
rm -f bisect*.out
rm -rf bisect_coverage
install:
cp vultc.native $(PREFIX)/vultc
.PHONY: all clean compiler js test