forked from Deducteam/Logipedia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
executable file
·190 lines (149 loc) · 5.95 KB
/
GNUmakefile
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
DKCHECK = dkcheck
DKDEP = dkdep
MATITAC = matitac
MAIN = _build/src/main.native
all: $(MAIN)
#### Main program ##################################################
$(MAIN): $(wildcard src/*.ml src/*.mli src/export/*.ml src/export/*.mli src/utils/*.ml src/utils/*.mli)
@echo "[BUILD] main.native"
@ocamlbuild -use-ocamlfind -quiet -Is src/,src/utils,src/export -tag thread -package mongo -package dedukti src/main.native
#### Producing the theory file #####################################
theories/sttfa.dko: theories/sttfa.dk
@echo "[CHECK] $^"
@$(DKCHECK) -e $^
#### Running examples ##############################################
EXADKS = $(wildcard examples/*.dk)
examples: $(EXADKS:.dk=.stt) $(EXADKS:.dk=.pdf)
examples/%.dko examples/%.stt examples/%.tex: examples/%.dk theories/sttfa.dko $(MAIN)
@echo "[STT] $<"
@./main.native -I theories $<
examples/%.pdf: examples/%.tex
@echo "[PDF] $@"
@pdflatex -output-directory=examples $< > /dev/null || echo "ERROR on $@"
#### Producing the Dedukti library #################################
LIBDKS = $(wildcard library/*.dk)
SORTEDDKS = $(shell dkdep -s -I theories/ -I library/ --ignore library/*.dk | cut -d" " -f 2,2-)
COQC := $(shell command -v coqc 2> /dev/null)
library/%.lean: library/%.dk theories/sttfa.dko .library_depend_lean $(MAIN)
@echo "[EXPORT] $@"
@./main.native -I library -I theories --export lean $(BDD) $<
library/%.pvs: library/%.dk theories/sttfa.dko .library_depend_pvs $(MAIN)
@echo "[EXPORT] $@"
@./main.native -I library -I theories --export pvs $(BDD) $<
library/%.v: library/%.dk theories/sttfa.dko .library_depend_v $(MAIN)
@echo "[EXPORT] $@"
@./main.native -I library -I theories --export coq $(BDD) $<
library/%.ma: library/%.dk theories/sttfa.dko .library_depend_ma $(MAIN)
@echo "[EXPORT] $@"
@./main.native -I library -I theories --export matita $(BDD) $<
library/%.art: library/%.dk theories/sttfa.dko .library_depend_art $(MAIN)
@echo "[EXPORT] $@"
@./main.native -I library -I theories --export opentheory $(BDD) $<
library/%.thy: .library_depend_dko
@echo "[GENERATE] $@"
@python3 bin/gen-thy-file.py $(notdir $(basename $@)) > $@
library/%.vo: library/%.v .library_depend_vo
@echo "[CHECK] $@"
@coqc -R library "" $<
library/%.summary: library/%.pvs
@echo "[SUMMARY]"
proveit --importchain -sf $<
.PRECIOUS: library/%.pvs
library/%.summary: library/%.pvs
@echo "[SUMMARY]"
proveit --importchain -sf $<
web: theories/sttfa.dko $(MAIN)
mongo < ./bdd/dropLogipedia.js
time ./main.native -I library -I theories --export-web $(SORTEDDKS)
coq: library/fermat.vo
matita: library/fermat.ma
$(MATITAC) library/fermat.ma | grep -v 'refinement' | grep -v 'ELPI' | grep -v 'type-checking'
pvs: library/fermat.pvs
proveit --importchain -sf library/fermat.pvs
lean: library/fermat.lean
leanpkg new /tmp/fermat
cp library/*.lean /tmp/fermat/src/
lean /tmp/fermat/src/fermat.lean
opentheory: library/fermat.thy library/fermat.art
opentheory info library/fermat.thy
.library_depend_dko: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
.library_depend_pvs: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/pvs/g $@
.library_depend_v: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/v/g $@
.library_depend_vo: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/vo/g $@
@sed -i s/dk/v/g $@
.library_depend_ma: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/ma/g $@
.library_depend_art: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/art/g $@
.library_depend_lean: $(wildcard library/*.dk theories/*.dk examples/*.dk)
@echo "[DEP] $@"
@$(DKDEP) -o $@ -I library -I theories $^
@sed -i s/theories\\/sttfa.dko//g $@
@sed -i s/dko/lean/g $@
ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), distclean)
-include .library_depend_dko
-include .library_depend_pvs
-include .library_depend_vo
-include .library_depend_v
-include .library_depend_ma
-include .library_depend_art
-include .library_depend_lean
endif
endif
#### Cleaning targets ##############################################
clean:
@ocamlbuild -clean -quiet
@rm -f .library_depend_dko
@rm -f .library_depend_v
@rm -f .library_depend_vo
@rm -f .library_depend_ma
@rm -f .library_depend_lean
@rm -f .library_depend_pvs
@rm -f .library_depend_art
distclean: clean
@find library -name "\#*" -exec rm {} \;
@find . -name "*~" -exec rm {} \;
@find . -name "*.dko" -exec rm {} \;
@find library -name "*.stt" -exec rm {} \;
@find library -name "*.aux" -exec rm {} \;
@find library -name "*.log" -exec rm {} \;
@find library -name "*.pdf" -exec rm {} \;
@find library -name "*.tex" -exec rm {} \;
@find library -name "*.pvs" -exec rm {} \;
@find library -name "*.prf" -exec rm {} \;
@find library -name "*.bin" -exec rm {} \;
@find library -name "*.dep" -exec rm {} \;
@find library -name "*.ma" -exec rm {} \;
@find library -name "*.v" -exec rm {} \;
@find library -name "*.vo" -exec rm {} \;
@find library -name "*.glob" -exec rm {} \;
@find library -name "*.lean" -exec rm {} \;
@find library -name "*.json" -exec rm {} \;
@find library -name "*.art" -exec rm {} \;
@find library -name "*.thy" -exec rm {} \;
@find library -name "*.summary" -exec rm {} \;
@find library -name "*.beautified" -exec rm {} \;
@find library -name ".pvscontext" -exec rm {} \;
@rm -rf /tmp/fermat
.PHONY: all clean distclean examples library coq matita pvs bdd-dep opentheory