aboutsummaryrefslogtreecommitdiff
path: root/Makefile.dune
blob: d201d1783acaa6eeb9630690e96ad4a7dc418b5e (plain)
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
# -*- mode: makefile -*-
# Dune Makefile for Coq

.PHONY: help voboot states world watch check quickbyte quickopt test-suite release apidoc ocheck ireport clean

# use DUNEOPT=--display=short for a more verbose build
# DUNEOPT=--display=short

BUILD_CONTEXT=_build/default

help:
	@echo "Welcome to Coq's Dune-based build system. Targets are:"
	@echo "  - states:  build a minimal functional coqtop"
	@echo "  - world:   build all binaries and libraries"
	@echo "  - watch:   build all binaries and libraries [continuous build]"
	@echo "  - check:   build all ML files as fast as possible [requires Dune >= 1.5.0]"
	@echo "  - quickbyte:  build main ML files [coqtop + plugins + ide + printers] using the bytecode compiler"
	@echo "  - quickopt:   build main ML files [coqtop + plugins + ide + printers] using the optimizing compiler"
	@echo "  - test-suite: run Coq's test suite"
	@echo "  - release: build Coq in release mode"
	@echo "  - apidoc:  build ML API documentation"
	@echo "  - ocheck:  build for all supported OCaml versions [requires OPAM]"
	@echo "  - ireport: build with optimized flambda settings and emit an inline report"
	@echo "  - clean:   remove build directory and autogenerated files"
	@echo "  - help:    show this message"

voboot:
	dune build $(DUNEOPT) @vodeps
	dune exec coq_dune $(BUILD_CONTEXT)/.vfiles.d

states: voboot
	dune build $(DUNEOPT) theories/Init/Prelude.vo

world: voboot
	dune build $(DUNEOPT) @install

watch: voboot
	dune build $(DUNEOPT) @install -w

check: voboot
	dune build $(DUNEOPT) @check

COQTOP_FILES=ide/idetop.bc ide/coqide_main.bc checker/coqchk.bc
PLUGIN_FILES=$(wildcard plugins/*/*.mlpack)
PRINTER_FILES=dev/top_printers.cma dev/checker_printers.cma
QUICKBYTE_TARGETS=$(COQTOP_FILES) $(PLUGIN_FILES:.mlpack=.cma) $(PRINTER_FILES) topbin/coqtop_byte_bin.bc
QUICKOPT_TARGETS=$(COQTOP_FILES:.bc=.exe) $(PLUGIN_FILES:.mlpack=.cmxa) $(PRINTER_FILES:.cma=.cmxa) topbin/coqtop_bin.exe

quickbyte: voboot
	dune build $(DUNEOPT) $(QUICKBYTE_TARGETS)

quickopt: voboot
	dune build $(DUNEOPT) $(QUICKOPT_TARGETS)

test-suite: voboot
	dune $(DUNEOPT) runtest

release: voboot
	dune build $(DUNEOPT) -p coq

apidoc: voboot
	dune build $(DUNEOPT) @doc

ocheck: voboot
	dune build $(DUNEOPT) @install --workspace=dev/dune-workspace.all

ireport:
	dune clean
	dune build $(DUNEOPT) @vodeps --profile=ireport
	dune exec coq_dune $(BUILD_CONTEXT)/.vfiles.d --profile=ireport
	dune build $(DUNEOPT) @install --profile=ireport

clean:
	dune clean

# Other common dev targets
#
# dune build coq.install
# dune build ide/coqide.install

# Packaging / OPAM targets:
#
# dune -p coq @install
# dune -p coqide @install