-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
99 lines (76 loc) · 2.74 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
# Options for erlang.mk
PROJECT = ecapnp
#test%: TEST_ERLC_OPTS += -DEUNIT_NOAUTO
CT_SUITES = proper #eunit
PLT_APPS = crypto
EDOC_OPTS = preprocess, {dir, "doc/html"}
EUNIT_OPTS = no_tty, {report, {eunit_progress, [colored]}}
EUNIT_DIR = test
# call `make tests TEST_DEPS=` after the first run in order to skip
# the `make all` for all test deps.. (which for meck using rebar is
# sloooow... :/ )
TEST_DEPS ?= meck proper eunit_formatters
dep_meck = https://github.com/eproxus/meck.git master
dep_proper = pkg://proper master
dep_eunit_formatters = git git://github.com/seancribbs/eunit_formatters master
include erlang.mk
# erlang.mk bootstrapping
# erlang.mk: erlang_mk_url ?= \
# http://raw.github.com/extend/erlang.mk/master/erlang.mk
# erlang.mk:
# @echo " GET " $@; wget -O $@ $(erlang_mk_url)
# build rules for .capnp files
%.capnp.hrl: %.capnp
$(gen_verbose) capnpc -oerl $<
%_capnp.erl: %.capnp | ebin
$(gen_verbose) ECAPNP_TO_ERL=../$(dir $@) capnpc\
-oerl:ebin --src-prefix=$(dir $<) $<
ebin:
@mkdir -p ebin
# make sure we rebuild on any header file change
%.erl: include/*.hrl include/*/*.hrl ; @touch $@
# capnp_test integration
dep_capnp_test = git://github.com/kaos/capnp_test.git
$(eval $(call dep_target,capnp_test))
bin/test.capnp.hrl: $(DEPS_DIR)/capnp_test/test.capnp
capnpc -oerl:$(dir $@) --src-prefix=$(dir $<) $<
.PHONY: check
check:: export CAPNP_TEST_APP = $(CURDIR)/bin/ecapnp_test
check:: $(DEPS_DIR)/capnp_test bin/test.capnp.hrl
$(MAKE) -C $<
# DEV/TEST-only target..
# call it as `make dbg PROP=text_data LINE=117`
# will dump you attached to a process running the text_data prop test,
# on line 117
# Currently we need ecapnp on the erlang lib path.. will fix that eventually..
.PHONY: bld dbg tst e p
bld: TEST_DEPS=
bld: TEST_ERLC_OPTS += -DEUNIT_NOAUTO
bld: app build-tests
dbg: bld
erl -pa ebin test -eval \
"begin\
[i:ii(M) || M <- [ecapnp, ecapnp_obj, ecapnp_get, ecapnp_set,\
ecapnp_props, ecapnp_ref, ecapnp_data]],\
i:ib(ecapnp_props, $(LINE)),\
i:iaa([break]),\
proper:quickcheck(ecapnp_props:prop_$(PROP)())\
end"
tst: e p
erl: bld
erl -pa ebin test priv/samples -eval \
"[i:ii(M) || M <- [ecapnp, ecapnp_obj, ecapnp_get, ecapnp_set,\
ecapnp_ref, ecapnp_data, ecapnp_schema, ecapnp_get_tests,\
ecapnp_set_tests, ecapnp_rpc, ecapnp_rpc_tests, ecapnp_vat,\
ecapnp_vat_tests, ecapnp_capability, ecapnp_capability_sup,\
ecapnp_ref_tests, 'calculator-server']]"
e: bld
erl -pa ebin test -pa deps/meck/ebin -noinput \
-eval "case eunit:test(\"test\", [no_tty, {report, {eunit_progress,\
[colored]}}]) of ok -> halt(0); _ -> halt(1) end"
p: bld
erl -pa ebin test -noinput \
-eval "proper:module(ecapnp_props), init:stop()"
.PHONY: samples
samples: app
cd priv/samples && ./run_samples.sh