-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile.ob
114 lines (81 loc) · 2.66 KB
/
Makefile.ob
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
PKGNAME=ostap
MKDIR ?= mkdir -vp
CP ?= cp
OB=ocamlbuild -use-ocamlfind -plugin-tag "package(str)" -classic-display
ifdef OBV
OB += -verbose 6
endif
#CMA_TARGETS=
#CMO_TARGETS=
#BYTE_TARGETS=$(CMA_TARGETS) $(CMO_TARGETS)
#NATIVE_TARGETS= $(CMA_TARGETS:.cma=.cmxa) $(CMO_TARGETS:.cmo=.cmx)
TESTS_ENVIRONMENT=./test.sh
.DEFAULT_GOAL := all
.PHONY: all bundle sample
.PHONY: celan clean clean_tests install uninstall
.PHONY: tests test regression promote
.DEFAULT_GOAL: all
all:
$(OB) src/ostap.cmo src/ostap.cmx
$(OB) pa_ostap.cmo -I src
$(OB) -Is src util/Util.cmo util/Util.cmx
$(OB) -Is src ostap.cmo ostap.cmx
celan: clean
clean: clean_tests
$(RM) -r _build *.log *.native *.byte
sample:
$(OB) sample/sample.native
######################## Tests related stuff ##########################
REGRES_CASES := $(shell seq -s \ -w 1 015)
define TESTRULES
BYTE_TEST_EXECUTABLES += camlp5/regression/test$(1).byte
NATIVE_TEST_EXECUTABLES += camlp5/regression/test$(1).native
.PHONY: test_$(1) test$(1).native compile_tests_native compile_tests_byte
test$(1).native: camlp5/regression/test$(1).native
test$(1).byte: camlp5/regression/test$(1).byte
regression/test$(1).byte: regression/test$(1).ml $(wildcard regression/$(1).mli)
$(OB) -Is src $$@
regression/test$(1).native: regression/test$(1).ml $(wildcard regression/$(1).mli)
$(OB) -Is src $$@
run_tests: test_$(1)
test_$(1):
@cd camlp5/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: all compile_tests run_tests
regression: tests
test: tests
######################## Installation related stuff ##########################
INSTALL_TARGETS=META \
_build/pa_ostap.cmo \
_build/ostap.cmo \
_build/ostap.cmx \
_build/ostap.cmi \
_build/ostap.o \
BUNDLEDIR=_build/bundle/$(PKGNAME)
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 $(PKGNAME) $(BUNDLEDIR)/*
uninstall:
ocamlfind remove $(PKGNAME)