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
-
41
1
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
126
50
127
51
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
154
55
155
56
nix :
156
- nix-shell --arg do-nothing true --run " updateNixToolBox & genNixActions"
57
+ nix-shell --arg do-nothing true --run " updateNixToolBox & genNixActions"
58
+ .PHONY : nix
0 commit comments