Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
241 lines (185 loc) · 5.87 KB
/
Copy pathMakefile
File metadata and controls
241 lines (185 loc) · 5.87 KB
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
.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 := ./_boot/dune.exe
# Dependencies recommended for developing dune locally,
# but not wanted in CI
DEV_DEPS := \
core_bench \
patdiff
TEST_OCAMLVERSION := 5.5.0
# When updating this version, don't forget to also bump the number in the docs.
-include Makefile.dev
.PHONY: help
help:
@cat doc/make-help.txt
.PHONY: bootstrap
bootstrap:
rm -rf _boot
$(MAKE) -B $(BIN)
.PHONY: test-bootstrap
test-bootstrap:
rm -rf _test_boot
@ocaml boot/bootstrap.ml --boot-dir _test_boot
.PHONY: test-bootstrap-script
test-bootstrap-script:
@ocamlc -i boot/bootstrap.ml
.PHONY: release
release: $(BIN)
@$(BIN) build dune.install -p dune --profile dune-bootstrap
$(BIN):
@ocaml boot/bootstrap.ml
dev: $(BIN)
$(BIN) build @install
watch: $(BIN)
$(BIN) build @install --watch
all: $(BIN)
$(BIN) build
.PHONY: install
install:
$(BIN) install $(INSTALL_ARGS) dune
.PHONY: uninstall
uninstall:
$(BIN) uninstall $(INSTALL_ARGS) dune
.PHONY: reinstall
reinstall: uninstall install
.PHONY: install-ocamlformat
install-ocamlformat:
opam install -y ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat)
.PHONY: dev-deps
dev-deps:
opam install -y . --deps-only --with-dev-setup
.PHONY: dev-deps-sans-melange
dev-deps-sans-melange: dev-deps
.PHONY: dev-switch
dev-switch:
opam update
# Ensuring that either a dev switch already exists or a new one is created
if test -d _opam ; then \
opam install -y --update-invariant ocaml.$(TEST_OCAMLVERSION); \
else \
opam switch create -y . $(TEST_OCAMLVERSION) --no-install ; \
fi
opam pin add -y . -n --with-version=dev
opam install -y . --deps-only --with-test --with-dev-setup
$(MAKE) install-ocamlformat
opam install -y $(DEV_DEPS)
.PHONY: index
index: $(BIN)
$(BIN) build @ocaml-index
.PHONY: test
test: $(BIN)
$(BIN) runtest
test-windows: $(BIN)
$(BIN) build @runtest-windows
test-js: $(BIN)
$(BIN) build @runtest-js
test-wasm: $(BIN)
DUNE_WASM_TEST=enable $(BIN) build @runtest-wasm
.PHONY: test-rocq
test-rocq: $(BIN)
DUNE_ROCQ_TEST=enable $(BIN) build @runtest-rocq
.PHONY: test-rocq-native
test-rocq-native: $(BIN)
DUNE_ROCQ_TEST=enable DUNE_ROCQ_NATIVE_TEST=enable $(BIN) build @runtest-rocq-native
test-melange: $(BIN)
$(BIN) build @runtest-melange
test-all: $(BIN)
DUNE_ROCQ_TEST=enable $(BIN) build @runtest @runtest-js @runtest-rocq @runtest-melange
test-ox: $(BIN)
$(BIN) runtest test/blackbox-tests/test-cases/oxcaml
.PHONY: check
check: $(BIN)
@$(BIN) build @check
.PHONY: start
start: $(BIN)
@[ -e start/dune ] || $(BIN) init start-file
@$(BIN) build @start/build -w
.PHONY: fmt
fmt: $(BIN)
@$(BIN) fmt
.PHONY: fmt-preview
fmt-preview: $(BIN)
@$(BIN) fmt --preview
.PHONY: promote
promote: $(BIN)
@$(BIN) promote
.PHONY: accept-corrections
accept-corrections: promote
.PHONY: clean
clean:
rm -rf _boot _build
distclean: clean
rm -f src/dune_rules/setup.ml
.PHONY: doc
doc:
sphinx-build -W doc doc/_build
# livedoc-deps: you may need to [pip3 install sphinx-autobuild] and [pip3 install -r doc/requirements.txt]
livedoc:
cd doc && sphinx-autobuild . _build --port 8888 -q --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: $(BIN)
@$(BIN) exec -- ./bench/bench.exe $(BIN)
.PHONY: dune
dune: $(BIN)
$(BIN) $(RUN_ARGS)
# Use this target to make sure that we always run the in source dune when making
# the release
.PHONY: opam-release
opam-release: dev
$(BIN) exec -- $(MAKE) dune-release
# Resume an interrupted publication from a single step, e.g. with
# 'make opam-release-opam-submit', still under the in source dune.
opam-release-%: dev
$(BIN) exec -- $(MAKE) dune-release-$*
# Set DUNE_RELEASE_YES_FLAG=true to force dune-release to run with the --yes flag
# Avoiding the need for interaction
DUNE_RELEASE_YES_FLAG := $(if $(filter true,$(DUNE_RELEASE_YES)),--yes)
# An alpha is submitted to opam as a draft pull request, so that it cannot be
# merged while its reverse dependency CI is still being triaged. Removes
# a manual step after every alpha.
DUNE_RELEASE_DRAFT_FLAG := $(if $(filter prerelease,$(RELEASE_KIND)),--draft)
# Publishing is a sequence of steps that is not transactional: a failure part
# way through leaves the earlier steps done. Each step is therefore also a
# target of its own, so that an interrupted release can be resumed from the
# step that failed rather than requiring a restart of entire process.
.PHONY: dune-release
dune-release:
$(MAKE) dune-release-tag
$(MAKE) dune-release-distrib
$(MAKE) dune-release-publish
$(MAKE) dune-release-opam-pkg
$(MAKE) dune-release-opam-submit
.PHONY: dune-release-tag
dune-release-tag:
dune-release tag $(DUNE_RELEASE_YES_FLAG)
.PHONY: dune-release-distrib
dune-release-distrib:
dune-release distrib --skip-build --skip-lint --skip-tests
.PHONY: dune-release-publish
dune-release-publish:
# See https://github.com/ocamllabs/dune-release/issues/206
DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish --verbose $(if $(filter prerelease,$(RELEASE_KIND)),--prerelease) $(DUNE_RELEASE_YES_FLAG)
.PHONY: dune-release-opam-pkg
dune-release-opam-pkg:
dune-release opam pkg $(DUNE_RELEASE_YES_FLAG)
.PHONY: dune-release-opam-submit
dune-release-opam-submit:
dune-release opam submit $(DUNE_RELEASE_DRAFT_FLAG) $(DUNE_RELEASE_YES_FLAG)
.PHONY: docker-build-image
docker-build-image:
docker build -f docker/dev.Dockerfile -t dune .
.PHONY: docker-compose
docker-compose:
docker compose -f docker/dev.yml run dune bash