forked from antalsz/hs-to-coq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (64 loc) · 1.96 KB
/
Makefile
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
include ../../common.mk
# tests that should pass
PASS = \
Deriv \
PatternGuard \
Expr \
Endo \
Type \
OpMeth \
NestTup \
Pair \
SplitAt \
PartialRecordSel \
# tests that *should* pass but currently fail
TODO_PASS = \
Arrow \
EqList \
TypeClient \
PaperExamples \
MODULES = $(PASS) $(TODO_PASS)
VFILES = $(addsuffix .v,$(MODULES))
VOFILES = $(patsubst %.v,%.vo,$(VFILES))
COQFLAGS = ""
TYPECHECK=coqc -Q ../../base/ ""
main:
# Call ourselves with -k, so that we see all test outputs,
# even if some fail
$(MAKE) -k all
all: $(VFILES) pass todo_pass
pass: $(addsuffix .pass,$(PASS))
@echo -------- END PASS ------------
todo_pass: $(foreach f,$(TODO_PASS),$(f).fail)
@echo
@echo "Any names printed without errors should be moved from TODO_PASS to PASS"
%.pass : %.v
@/bin/echo -n "$<: "
@if ! test -e $<; \
then echo -e "\033[1;31mmissing\033[0m (should pass)"; exit 1;\
elif ! $(TYPECHECK) $< >&/dev/null; \
then echo -e "\033[1;31mfailed\033[0m (should pass)"; exit 1; \
else echo -e "\033[1;32mpassed\033[0m"; \
fi
%.fail : %.v
@/bin/echo -n "$<: "
@if ! test -e $<; \
then echo -e "\033[1;31mmissing\033[0m"; \
elif ! $(TYPECHECK) $< >&/dev/null; \
then echo -e "\033[1;31mfailed\033[0m"; \
else echo -e "\033[1;32mpassed\033[0m (unexpected)"; exit 1; \
fi
%.vo : %.v
$(TYPECHECK) $*.v
.SECONDEXPANSION:
%.v : FORCE $$(wildcard $*/edits) $$(wildcard $*/preamble.v) $$(wildcard $*/midamble.v) %.hs
@rm -f $*.v
@if [ -e $*/preamble.v ]; then P_ARG="-p $*/preamble.v"; else P_ARG=; fi; \
if [ -e $*/midamble.v ]; then M_ARG="-m $*/midamble.v"; else M_ARG=; fi; \
if [ -e $*/edits ]; then E_ARG="-e $*/edits"; else E_ARG=; fi;\
$(HS_TO_COQ) $${E_ARG} -e ../../base/edits -o . $${P_ARG} $${M_ARG} $*.hs 1>/dev/null
# We always want to re-build the .v files, to test the current build of hs-to-coq
FORCE:
clean:
rm -rf */*.vo */*.glob */*.v.d *.vo *.v.d *.glob $(VFILES) _CoqProject Makefile.coq *~
.SECONDARY: $(VFILES)