forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
155 lines (119 loc) · 3.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
.DEFAULT_GOAL := help
PREFIX_ARG := $(if $(PREFIX),--prefix $(PREFIX),)
LIBDIR_ARG := $(if $(LIBDIR),--libdir $(LIBDIR),)
DESTDIR_ARG := $(if $(DESTDIR),--destdir $(DESTDIR),)
INSTALL_ARGS := $(PREFIX_ARG) $(LIBDIR_ARG) $(DESTDIR_ARG)
BIN := ./dune.exe
# Dependencies used for testing dune, when developed locally and
# when tested in CI
TEST_DEPS := \
lwt \
bisect_ppx \
cinaps \
coq-native \
"coq>=8.14.0" \
core_bench \
"csexp>=1.3.0" \
js_of_ocaml \
js_of_ocaml-compiler \
mdx \
menhir \
"merlin>=3.4.0" \
ocamlfind \
ocamlformat.0.19.0 \
"odoc>=2.0.1" \
"ppx_expect>=v0.14" \
ppx_inline_test \
ppxlib \
result \
ctypes \
"utop>=2.6.0"
# Dependencies recommended for developing dune locally,
# but not wanted in CI
DEV_DEPS := \
patdiff
-include Makefile.dev
help:
@cat doc/make-help.txt
release: $(BIN)
@$(BIN) build -p dune --profile dune-bootstrap
dune.exe: bootstrap.ml boot/libs.ml boot/duneboot.ml
@ocaml bootstrap.ml
dev: $(BIN)
$(BIN) build @install
all: $(BIN)
$(BIN) build
install:
$(BIN) install $(INSTALL_ARGS) dune
uninstall:
$(BIN) uninstall $(INSTALL_ARGS) dune
reinstall: uninstall install
dev-deps:
opam install -y $(TEST_DEPS)
dev-switch:
opam update
# Ensuring that either a dev switch already exists or a new one is created
test "$(shell opam switch show)" = "$(shell pwd)" || \
opam switch create -y . 4.12.0 --deps-only --with-test
opam install -y $(TEST_DEPS) $(DEV_DEPS)
test: $(BIN)
$(BIN) runtest
test-windows: $(BIN)
$(BIN) build @runtest-windows
test-js: $(BIN)
$(BIN) build @runtest-js
test-coq: $(BIN)
$(BIN) build @runtest-coq
test-all: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-coq
check: $(BIN)
$(BIN) build @check
fmt: $(BIN)
$(BIN) build @fmt --auto-promote
promote: $(BIN)
$(BIN) promote
accept-corrections: promote
all-supported-ocaml-versions: $(BIN)
$(BIN) build @install @runtest --workspace dune-workspace.dev --root .
clean: $(BIN)
$(BIN) clean || true
rm -rf _boot dune.exe
distclean: clean
rm -f src/dune_rules/setup.ml
doc:
sphinx-build doc doc/_build
# livedoc-deps: you may need to [pip3 install sphinx-autobuild] and [pip3 install sphinx-rtd-theme]
livedoc:
cd doc && sphinx-autobuild . _build \
--port 8888 -q --host $(shell hostname) --re-ignore '\.#.*'
update-jbuilds: $(BIN)
$(BIN) build @doc/runtest --auto-promote
# If the first argument is "run"...
ifeq (dune,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
.PHONY: bench
bench: release
@$(BIN) exec -- ./bench/bench.exe _build/default/dune.exe 2> /dev/null
dune: $(BIN)
$(BIN) $(RUN_ARGS)
.PHONY: default install uninstall reinstall clean test doc dev-switch
.PHONY: promote accept-corrections release opam-release dune check fmt
# Use this target to make sure that we always run the in source dune when making
# the release
opam-release: dev
$(BIN) exec -- $(MAKE) dune-release
dune-release:
dune-release tag
dune-release distrib --skip-build --skip-lint --skip-tests -n dune
# See https://github.com/ocamllabs/dune-release/issues/206
DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib --verbose -n dune
dune-release opam pkg -n dune
dune-release opam submit -n dune
# see nix/default.nix for details
.PHONY: nix/opam-selection.nix
nix/opam-selection.nix: Makefile
nix-shell -A resolve ./