-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
136 lines (97 loc) · 3.31 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
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
SHELL := /bin/bash
MKDIR ?= mkdir -vp
CP ?= cp
OB=ocamlbuild -use-ocamlfind -plugin-tag "package(str)" -classic-display
ifdef OBV
OB += -verbose 6
endif
CMA_TARGETS=src/MiniKanren.cma
CMO_TARGETS=#src/tester.cmo
BYTE_TARGETS=$(CMA_TARGETS) $(CMO_TARGETS)
NATIVE_TARGETS= $(CMA_TARGETS:.cma=.cmxa) $(CMO_TARGETS:.cmo=.cmx)
TESTS_ENVIRONMENT=./test.sh
JSOO_LIB=jsoo_runner/jsoo_runner.cma
.PHONY: all celan clean clean_tests install uninstall tests test regression promote \
only-toplevel toplevel minikanren_stuff tester bundle plugin
.DEFAULT_GOAL: all
all: minikanren_stuff plugin bundle perf eval
eval:
pushd perf_tests && make evaluate && popd
perf:
pushd perf_tests && make && popd
minikanren_stuff:
$(OB) -Is src $(BYTE_TARGETS) $(NATIVE_TARGETS)
plugin:
$(OB) camlp5/pa_minikanren.cmo
celan: clean
clean: clean_tests
$(RM) -r _build *.log *.native *.byte
$(MAKE) -C perf_tests clean
######################## Tests related stuff ##########################
REGRES_CASES := 016 # 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015
define TESTRULES
BYTE_TEST_EXECUTABLES += regression/test$(1).byte
NATIVE_TEST_EXECUTABLES += regression/test$(1).native
TEST_MLS += regression/test$(1).ml
.PHONY: test_$(1) test$(1).native compile_tests_native compile_tests_byte
test$(1).native: regression/test$(1).native
test$(1).byte: regression/test$(1).byte
regression/test$(1).byte: regression/test$(1).ml
$(OB) -Is src $$@
regression/test$(1).native: regression/test$(1).ml
$(OB) -Is src $$@
run_tests: test_$(1)
test_$(1):
@cd regression && $(TESTS_ENVIRONMENT) ../test$(1).native; \
if [ $$$$? -ne 0 ] ; then echo "$(1) FAILED"; else echo "$(1) PASSED"; fi
endef
$(foreach i,$(REGRES_CASES),$(eval $(call TESTRULES,$(i)) ) )
.PHONY: compile_tests_native compile_tests_byte compile_tests run_tests
compile_tests_native: $(TEST_MLS)
$(OB) -Is src $(NATIVE_TEST_EXECUTABLES)
compile_tests_byte: $(TEST_MLS)
$(OB) -Is src $(BYTE_TEST_EXECUTABLES)
compile_tests: compile_tests_native
clean_tests:
$(RM) -r _build/regression
promote:
$(MAKE) -C regression promote TEST=$(TEST)
tests: plugin minikanren_stuff compile_tests run_tests
regression: tests
test: tests
######################## Installation related stuff ##########################
INSTALL_TARGETS=META \
$(wildcard _build/regression/tester.cmi) \
$(wildcard _build/regression/tester.cmo) \
$(wildcard _build/regression/tester.cmx) \
$(wildcard _build/src/*.cmi) \
_build/src/MiniKanren.cma \
_build/src/MiniKanren.cmxa \
$(wildcard _build/src/MiniKanren.[oa]) \
$(wildcard _build/camlp5/pa_minikanren.cm[oi]) \
# _build/src/tester.o \
MAYBE_INSTALL_TARGETS=\
_build/jsoo_runner/jsoo_runner.cmi \
_build/jsoo_runner/jsoo_runner.cma \
define MAYBE_ADD_TARGET
ifneq (,$(wildcard $(1)))
INSTALL_TARGETS += $(1)
endif
endef
$(foreach i,$(MAYBE_INSTALL_TARGETS),$(eval $(call MAYBE_ADD_TARGET,$(i)) ) )
BUNDLEDIR=_build/bundle/ocanren
define MAKE_BUNDLE_RULE
$(BUNDLEDIR)/$(notdir $(1)): $(1)
cp $(1) $(BUNDLEDIR)
MAKE_BUNDLE_TARGETS += $(BUNDLEDIR)/$(notdir $(1))
endef
$(foreach i,$(INSTALL_TARGETS),$(eval $(call MAKE_BUNDLE_RULE,$(i)) ) )
rmbundledir:
@$(RM) -r $(BUNDLEDIR)
$(BUNDLEDIR):
@$(MKDIR) $@
bundle: rmbundledir $(BUNDLEDIR) $(MAKE_BUNDLE_TARGETS)
install: bundle
ocamlfind install ocanren $(BUNDLEDIR)/*
uninstall:
ocamlfind remove ocanren