Skip to content

Commit f306182

Browse files
garesrlepigre
andcommitted
Port to the [dune] build system.
The [_CoqProject] is still useful for editors, it was partially generated using: ``` grep "^ (name" apps/**/dune | \ grep -v src | \ sed 's/apps\/\([a-zA-Z]*\)\/\([a-zA-Z]*\)\/dune: (name \([^)]*\))/-Q apps\/\1\/\2 elpi.apps.\1.\2\n-Q _build\/default\/apps\/\1\/\2 elpi.apps.\1.\2/' | sed 's/\.theories//' ``` Co-Authored-By: Rodolphe Lepigre <[email protected]>
1 parent 78d8c2c commit f306182

File tree

122 files changed

+611
-1346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+611
-1346
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ apps/coercion/src/coq_elpi_coercion_hook.ml
4949
.filestoinstall
5050
apps/tc/src/coq_elpi_tc_hook.ml
5151
apps/cs/src/coq_elpi_cs_hook.ml
52+
_build

Makefile

Lines changed: 53 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,58 @@
1-
2-
# detection of coq
3-
ifeq "$(COQBIN)" ""
4-
COQBIN := $(shell which coqc >/dev/null 2>&1 && dirname `which coqc`)
5-
endif
6-
ifeq "$(COQBIN)" ""
7-
$(error Coq not found, make sure it is installed in your PATH or set COQBIN)
8-
else
9-
$(info Using coq found in $(COQBIN), from COQBIN or PATH)
10-
endif
11-
export COQBIN := $(COQBIN)/
12-
13-
# detection of elpi
14-
ifeq "$(ELPIDIR)" ""
15-
ELPIDIR=$(shell ocamlfind query elpi 2>/dev/null)
16-
endif
17-
ifeq "$(ELPIDIR)" ""
18-
$(error Elpi not found, make sure it is installed in your PATH or set ELPIDIR)
19-
endif
20-
export ELPIDIR
21-
22-
DEPS=$(ELPIDIR)/elpi.cmxa $(ELPIDIR)/elpi.cma
23-
24-
APPS=$(addprefix apps/, derive eltac NES locker coercion cs tc)
25-
26-
ifeq "$(COQ_ELPI_ALREADY_INSTALLED)" ""
27-
DOCDEP=build
28-
else
29-
DOCDEP=
30-
endif
31-
32-
ifndef DOCDIR
33-
DOCDIR=$(shell $(COQBIN)/coqc -where)/../../share/doc/coq-elpi
34-
endif
35-
36-
ifndef COQDOCINSTALL
37-
COQDOCINSTALL=$(DESTDIR)$(DOCDIR)
38-
endif
39-
40-
411
all:
42-
$(MAKE) build-core
43-
$(MAKE) test-core
44-
$(MAKE) examples
45-
$(MAKE) build-apps
46-
$(MAKE) test-apps
47-
48-
build-core: Makefile.coq $(DEPS)
49-
@echo "########################## building plugin ##########################"
50-
@if [ -x $(COQBIN)/coqtop.byte ]; then \
51-
$(MAKE) --no-print-directory -f Makefile.coq bytefiles; \
52-
fi
53-
@$(MAKE) --no-print-directory -f Makefile.coq opt
54-
55-
build-apps: build-core
56-
@echo "########################## building APPS ############################"
57-
@$(foreach app,$(APPS),$(MAKE) -C $(app) build &&) true
58-
59-
build: build-core build-apps
60-
61-
test-core: Makefile.test.coq $(DEPS) build-core
62-
@echo "########################## testing plugin ##########################"
63-
@$(MAKE) --no-print-directory -f Makefile.test.coq
64-
65-
test-apps: build-apps
66-
@echo "########################## testing APPS ############################"
67-
@$(foreach app,$(APPS),$(MAKE) -C $(app) test &&) true
68-
69-
test: test-core test-apps
70-
71-
examples: Makefile.examples.coq $(DEPS) build-core
72-
@echo "############################ examples ############################"
73-
@$(MAKE) --no-print-directory -f Makefile.examples.coq
74-
75-
doc: $(DOCDEP)
76-
@echo "########################## generating doc ##########################"
77-
@mkdir -p doc
78-
@$(foreach tut,$(wildcard examples/tutorial*$(ONLY)*.v),\
79-
echo ALECTRYON $(tut) && ./etc/alectryon_elpi.py \
80-
--frontend coq+rst \
81-
--output-directory doc \
82-
--pygments-style vs \
83-
-R theories elpi -Q src elpi \
84-
$(tut) &&) true
85-
@cp stlc.html doc/
86-
@cp etc/tracer.png doc/
87-
88-
.merlin: force
89-
@rm -f .merlin
90-
@$(MAKE) --no-print-directory -f Makefile.coq $@
91-
92-
.PHONY: force build all test doc
93-
94-
Makefile.coq Makefile.coq.conf: src/coq_elpi_builtins_HOAS.ml src/coq_elpi_builtins_arg_HOAS.ml src/coq_elpi_config.ml _CoqProject
95-
@$(COQBIN)/coq_makefile -f _CoqProject -o Makefile.coq
96-
@$(MAKE) --no-print-directory -f Makefile.coq .merlin
97-
Makefile.test.coq Makefile.test.coq.conf: _CoqProject.test
98-
@$(COQBIN)/coq_makefile -f _CoqProject.test -o Makefile.test.coq
99-
Makefile.examples.coq Makefile.examples.coq.conf: _CoqProject.examples
100-
@$(COQBIN)/coq_makefile -f _CoqProject.examples -o Makefile.examples.coq
101-
src/coq_elpi_builtins_arg_HOAS.ml: elpi/coq-arg-HOAS.elpi Makefile.coq.local
102-
echo "(* Automatically generated from $<, don't edit *)" > $@
103-
echo "(* Regenerate via 'make $@' *)" >> $@
104-
echo "let code = {|" >> $@
105-
cat $< >> $@
106-
echo "|}" >> $@
107-
src/coq_elpi_builtins_HOAS.ml: elpi/coq-HOAS.elpi Makefile.coq.local
108-
echo "(* Automatically generated from $<, don't edit *)" > $@
109-
echo "(* Regenerate via 'make $@' *)" >> $@
110-
echo "let code = {|" >> $@
111-
cat $< >> $@
112-
echo "|}" >> $@
113-
114-
src/coq_elpi_config.ml:
115-
echo "let elpi_dir = \"$(abspath $(ELPIDIR))\";;" > $@
116-
117-
clean: Makefile.coq Makefile.test.coq
118-
@$(MAKE) -f Makefile.coq $@
119-
@$(MAKE) -f Makefile.test.coq $@
120-
@$(foreach app,$(APPS),$(MAKE) -C $(app) $@ &&) true
121-
122-
include Makefile.coq.conf
123-
V_FILES_TO_INSTALL := \
124-
$(filter-out theories/wip/%.v,\
125-
$(COQMF_VFILES))
2+
@dune build
3+
.PHONY: all
4+
5+
build-core:
6+
@dune build theories
7+
.PHONY: build-core
8+
9+
build-apps:
10+
@dune build $$(find apps -type d -name theories)
11+
.PHONY: build-apps
12+
13+
build:
14+
@dune build @install
15+
.PHONY: build
16+
17+
test-core:
18+
@dune build tests
19+
.PHONY: test-core
20+
21+
test-apps:
22+
@dune build $$(find apps -type d -name tests)
23+
.PHONY: test-apps
24+
25+
test:
26+
@dune build $$(find . -type d -name tests)
27+
.PHONY: test
28+
29+
examples:
30+
@dune build examples
31+
.PHONY: examples
32+
33+
# FIXME
34+
#doc: $(DOCDEP)
35+
# @echo "########################## generating doc ##########################"
36+
# @mkdir -p doc
37+
# @$(foreach tut,$(wildcard examples/tutorial*$(ONLY)*.v),\
38+
# echo ALECTRYON $(tut) && ./etc/alectryon_elpi.py \
39+
# --frontend coq+rst \
40+
# --output-directory doc \
41+
# --pygments-style vs \
42+
# -R theories elpi -Q src elpi \
43+
# $(tut) &&) true
44+
# @cp stlc.html doc/
45+
# @cp etc/tracer.png doc/
46+
47+
clean:
48+
@dune clean
49+
.PHONY: clean
12650

12751
install:
128-
@echo "########################## installing plugin ############################"
129-
@$(MAKE) -f Makefile.coq $@ VFILES="$(V_FILES_TO_INSTALL)"
130-
@if [ -x $(COQBIN)/coqtop.byte ]; then \
131-
$(MAKE) -f Makefile.coq $@-byte VFILES="$(V_FILES_TO_INSTALL)"; \
132-
fi
133-
-cp etc/coq-elpi.lang $(COQMF_COQLIB)/ide/
134-
@echo "########################## installing APPS ############################"
135-
@$(foreach app,$(APPS),$(MAKE) -C $(app) $@ &&) true
136-
@echo "########################## installing doc ############################"
137-
-mkdir -p $(COQDOCINSTALL)
138-
-cp doc/* $(COQDOCINSTALL)
139-
@echo "########################## installed ############################"
140-
141-
142-
# compile just one file
143-
theories/%.vo: force
144-
@$(MAKE) --no-print-directory -f Makefile.coq $@
145-
tests/%.vo: force build-core Makefile.test.coq
146-
@$(MAKE) --no-print-directory -f Makefile.test.coq $@
147-
examples/%.vo: force build-core Makefile.test.coq
148-
@$(MAKE) --no-print-directory -f Makefile.test.coq $@
149-
150-
SPACE=$(XXX) $(YYY)
151-
apps/%.vo: force
152-
@$(MAKE) -C apps/$(word 1,$(subst /, ,$*)) \
153-
$(subst $(SPACE),/,$(wordlist 2,99,$(subst /, ,$*))).vo
52+
@dune build -p coq-elpi
53+
@dune install coq-elpi
54+
.PHONY: install
15455

15556
nix:
156-
nix-shell --arg do-nothing true --run "updateNixToolBox & genNixActions"
57+
nix-shell --arg do-nothing true --run "updateNixToolBox & genNixActions"
58+
.PHONY: nix

Makefile.coq.local

Lines changed: 0 additions & 24 deletions
This file was deleted.

Makefile.release

Lines changed: 0 additions & 14 deletions
This file was deleted.

Makefile.test.coq.local

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)