forked from coq-community/coq-dpdgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
298 lines (222 loc) · 7.97 KB
/
Makefile.in
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is part of the DpdGraph tools.
# Copyright (C) 2009-2017 Anne Pacalet ([email protected])
# and Yves Bertot ([email protected])
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is distributed under the terms of the
# GNU Lesser General Public License Version 2.1
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.SUFFIXES:
ECHO=@echo
ECHO_CIBLE = $(ECHO) " * build $@"
PRE=dpd
NAME=@PACKAGE_NAME@
VERSION=@PACKAGE_VERSION@
BINDIR=@BINDIR@
DPDPLUGIN=./dpdgraph.vo
DPD2DOT=./dpd2dot
DPDUSAGE=./dpdusage
INCLUDES = -I @OCAMLGRAPH_PATH@
all : $(DPDPLUGIN) $(DPD2DOT) $(DPDUSAGE)
DISTRIBUTED = $(PRE)_compute.ml $(PRE)_dot.ml \
$(PRE)_parse.mly $(PRE)_lex.mll $(PRE)2dot.ml $(PRE)usage.ml
DISTRIBUTED+=dpdgraph.v
ML_COMMON = version.ml $(PRE)_compute.ml $(PRE)_dot.ml \
$(PRE)_parse.ml $(PRE)_lex.ml
ML_DPD2DOT = $(PRE)2dot.ml
ML_DPDUSAGE = $(PRE)usage.ml
ML_ALL = $(ML_COMMON) $(ML_DPD2DOT) $(ML_DPDUSAGE)
CMOS_DPD2DOT=$(ML_COMMON:%.ml=%.cmo) $(ML_DPD2DOT:%.ml=%.cmo)
CMOS_DPDUSAGE=$(ML_COMMON:%.ml=%.cmo) $(ML_DPDUSAGE:%.ml=%.cmo)
CMXS=$(ML_ALL:%.ml=%.cmx)
OCAMLC=@OCAMLC@
OCAMLOPT=@OCAMLOPT@
OCAMLDEP=@OCAMLDEP@
OCAMLLEX=@OCAMLLEX@
OCAMLYACC=@OCAMLYACC@
OCAMLFLAGS := -w +a -warn-error +a -g -dtypes $(INCLUDES) -c
OCAMLFLAGS += $(OCAML_EXTRA_OPTS)
OCAMLOPTFLAGS = -c
COQ_MAKEFILE=@COQ_MAKEFILE@
# COQDEP=$(OCAMLDEP)
COQEXTFILES=searchdepend.ml4 graphdepend.ml4
GENERATED+=$(COQEXTFILES:%.ml4=%.o) $(COQEXTFILES:%.ml4=%.cmx) dpdgraph.cmxs
DISTRIBUTED+=$(COQEXTFILES) dpdgraph.mllib
DISTRIBUTED+=Make
install : Make_coq
$(MAKE) -f $< install
cp dpd2dot dpdusage $(BINDIR)/
$(DPDPLUGIN) : Make_coq $(DISTRIBUTED)
$(ECHO_CIBLE)
$(MAKE) -f $< $@
Make_coq : Make
$(ECHO_CIBLE)
$(COQ_MAKEFILE) -f $< -o $@
GENERATED+= Make_coq
version.ml : configure
$(ECHO_CIBLE)
$(ECHO) "(* This file is generated by Makefile. Do not modify. *)" > $@
$(ECHO) "let version = \""$(VERSION)"\"" >> $@
GENERATED+=version.ml
$(DPD2DOT) : $(CMOS_DPD2DOT)
$(ECHO_CIBLE)
$(OCAMLC) -g $(INCLUDES) -o $@ graph.cma $(CMOS_DPD2DOT)
$(DPDUSAGE) : $(CMOS_DPDUSAGE)
$(ECHO_CIBLE)
$(OCAMLC) -g $(INCLUDES) -o $@ graph.cma $(CMOS_DPDUSAGE)
%.cmo : %.ml
$(ECHO_CIBLE)
$(OCAMLC) $(OCAMLFLAGS) $<
%.cmx : %.ml
$(ECHO_CIBLE)
$(OCAMLOPT) $(OPTPACKFLAGS) $(OCAMLOPTFLAGS) $<
%.cmi : %.mli
$(ECHO_CIBLE)
$(OCAMLC) $(OCAMLFLAGS) $<
%.ml : %.mll
$(ECHO_CIBLE)
$(OCAMLLEX) $<
GENERATED+=$(PRE)_lex.ml
%.ml : %.mly
$(ECHO_CIBLE)
$(OCAMLYACC) $<
GENERATED+=$(PRE)_parse.ml $(PRE)_parse.mli
depend: .depend
.depend : $(ML_ALL)
$(ECHO_CIBLE)
$(OCAMLDEP) $(ML_ALL) *.mli > $@
include .depend
GENERATED+=.depend
#-------------------------------------------------------------------------------
TESTDIR=tests
TESTS_SRC=$(TESTDIR)/Morph.v $(TESTDIR)/Test.v $(TESTDIR)/Polymorph.v \
$(TESTDIR)/PrimitiveProjections.v\
$(TESTDIR)/Morph.cmd $(TESTDIR)/Test.cmd $(TESTDIR)/search.cmd \
$(TESTDIR)/Polymorph.cmd $(TESTDIR)/PrimitiveProjections.cmd
TESTS_DPD=$(TESTDIR)/graph.dpd $(TESTDIR)/graph2.dpd \
$(TESTDIR)/Morph.dpd $(TESTDIR)/Morph_rw.dpd \
$(TESTDIR)/Polymorph.dpd \
$(TESTDIR)/PrimitiveProjections.dpd \
$(TESTDIR)/PrimitiveProjections2.dpd
TESTS_DOT=$(TESTS_DPD:%.dpd=%.dot)
TESTS_ERR_DPD=$(wildcard $(TESTDIR)/*.err.dpd)
TESTS=$(TESTS_DPD) $(TESTS_DOT) $(TESTDIR)/graph.without.dot \
$(TESTDIR)/search $(TESTDIR)/graph2.dpdusage \
$(TESTS_ERR_DPD:%.dpd=%) $(TESTDIR)/file_not_found.err
TESTS_LOG=$(TESTS:%=%.log)
TESTS_ORACLE=$(TESTS:%=%.oracle)
TESTS_OK=$(TESTS:%=%.ok)
DISTRIBUTED+=$(TESTS_SRC) $(TESTS_ORACLE)
.PRECIOUS : $(TESTS) $(TESTS_LOG) $(TESTS_ORACLE)
.PHONY: tests test
tests test : $(TESTS_OK)
.PHONY: test-suite
test-suite:
rm -f tests.ok
($(MAKE) tests && touch tests.ok) | tee tmp.log
if grep DIFFERENCES tmp.log >/dev/null 2>&1 ; then \
for i in $$(grep DIFFERENCES tmp.log | grep -o 'diff .*' | sed s'/diff //g' | sed s'/ /~/g'); do \
i="$$(echo "$$i" | sed s'/~/ /g')"; \
echo diff $$i; \
diff $$i; \
done ; \
fi
if grep DIFFERENCES tmp.log >/dev/null 2>&1 ; then false ; else true ; fi
rm tests.ok
$(TESTDIR)/%.dpdusage.log: $(TESTDIR)/%.dpd $(DPDUSAGE)
$(DPDUSAGE) $< > $@
$(TESTDIR)/file_not_found.err.log: $(DPD2DOT)
$(DPD2DOT) file_not_found.err.dpd > $@ 2>&1
$(TESTDIR)/%.err.log: $(TESTDIR)/%.err.dpd $(DPD2DOT)
$(DPD2DOT) $< > $@ 2>&1
%.log : %
cp $< $@
%.vo : %.v
coqc -q -R . dpdgraph $<
%.html : %.v
coqdoc $<
%.svg : %.dot
dot -Tsvg -o$@ $<
$(TESTDIR)/Morph%.dpd : $(TESTDIR)/Morph.vo $(TESTDIR)/Morph.cmd $(DPDPLUGIN)
# cd to tests to generate .dpd file there.
cd $(TESTDIR); coqtop -R .. dpdgraph -I .. < Morph.cmd > /dev/null 2>&1
$(TESTDIR)/Polymorph%.dpd : $(TESTDIR)/Polymorph.vo $(TESTDIR)/Polymorph.cmd \
$(DPDPLUGIN)
cd $(TESTDIR); coqtop -R .. dpdgraph -I .. < Polymorph.cmd
$(TESTDIR)/graph.dpd $(TESTDIR)/graph2.dpd: \
$(TESTDIR)/Test.vo $(TESTDIR)/Test.cmd $(DPDPLUGIN)
# cd to tests to generate .dpd file there.
cd $(TESTDIR); coqtop -R .. dpdgraph -I .. < Test.cmd > /dev/null 2>&1
$(TESTDIR)/PrimitiveProjections.dpd $(TESTDIR)/PrimitiveProjections2.dpd: \
$(TESTDIR)/PrimitiveProjections.vo $(TESTDIR)/PrimitiveProjections.cmd $(DPDPLUGIN)
# cd to tests to generate .dpd file there.
cd $(TESTDIR); coqtop -R .. dpdgraph -I .. < PrimitiveProjections.cmd > /dev/null 2>&1
%.dpd : %.vo %.cmd
# cd to tests to generate .dpd file there.
cd $(TESTDIR); coqtop -R .. dpdgraph -I .. < $(*F).cmd > /dev/null 2>&1
$(TESTDIR)/search.log : $(TESTDIR)/Test.vo $(TESTDIR)/search.cmd $(DPDPLUGIN)
cat $(TESTDIR)/search.cmd | coqtop -R . dpdgraph 2> /dev/null \
| sed -e 's/Welcome to Coq.*/Welcome to Coq/' > $@
%.dot : %.dpd $(DPD2DOT)
$(DPD2DOT) $< > /dev/null
%.without.dot : %.dpd $(DPD2DOT)
$(DPD2DOT) -without-defs -o $@ $< > /dev/null
%.zgr : %.dot
zgrviewer $<
%.ok : %.log %.oracle
$(ECHO_CIBLE)
@if diff $*.oracle $*.log > /dev/null ; then \
echo "Bravo... Test [32mOk[0m" ; \
touch $@ ; \
else \
echo "[31mDIFFERENCES[0m : diff $*.oracle $*.log" ; \
echo "To force a new execution of the test:" ; \
echo " rm $*.log ; make $*.ok"; \
echo "[31mTo accept the results[0m: " ; \
echo " cp $*.log $*.oracle" ; \
rm -f $@ ; \
fi
# oracle is updated by user, but one is needed the first time
%.oracle :
$(ECHO_CIBLE) "[WARNING : automatic generation of $@]"
$(MAKE) $*.log
cp $*.log $*.oracle
#-------------------------------------------------------------------------------
DISTRIBUTED+=Makefile LICENSE README.md configure Makefile.in
distrib : $(NAME)-$(VERSION).tgz
%.tgz : clean
$(ECHO_CIBLE)
rm -rf $* $@
mkdir $*
cp --parents $(DISTRIBUTED) $*
tar zcvf $@ $*
rm -rf $*
$(ECHO) "Don't forget to copy README.md and $@ on the server if needed"
#-------------------------------------------------------------------------------
# Configuration
Makefile: Makefile.in config.status
$(ECHO_CIBLE)
./config.status $@
config.status: configure
./config.status --recheck
#-------------------------------------------------------------------------------
clean_coq : Make_coq
$(MAKE) -f $< clean
clean_test :
rm -f $(TESTS) $(TESTS_LOG) $(TESTS_OK)
rm -f $(TESTDIR)/Test.vo $(TESTDIR)/Test.glob
rm -f $(TESTDIR)/Morph.vo $(TESTDIR)/Morph.glob
rm -f $(TESTDIR)/Polymorph.vo $(TESTDIR)/Polymorph.glob
rm -f $(TESTDIR)/.*.vo.aux
clean_config:
rm -rf autom4te.cache
rm -f configure config.log config.status
rm -r Makefile
clean : clean_coq clean_test
rm -f $(GENERATED)
rm -f $(CMOS_DPDUSAGE) $(CMOS_DPD2DOT) $(CMXS) $(ML_ALL:%.ml=%.o) *.cmi
rm -f $(ML_ALL:%.ml=%.annot)
rm -f $(DPD2DOT) $(DPDUSAGE) $(DPDPLUGIN)
$(ECHO) "Use: make clean_config to remove configuration generated files"
archi_clean: clean clean_config
#-------------------------------------------------------------------------------