forked from nitrogen/simple_bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·133 lines (92 loc) · 3.33 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
BACKEND:=inets
all: compile
get-deps:
./rebar get-deps
compile: get-deps
./rebar compile
clean: clean-deps
./rebar --config "rebar.$(BACKEND).config" clean
clean-deps:
rm -fr deps/*
platform: clean
(escript rebar_deps/merge_deps.escript rebar.config rebar_deps/$(BACKEND).deps rebar.$(BACKEND).config)
(./rebar --config "rebar.$(BACKEND).config" get-deps)
(./rebar --config "rebar.$(BACKEND).config" compile)
(rm -f rebar.$(BACKEND).config)
run_cowboy:
(make platform run BACKEND=cowboy)
run_elli:
(make platform run BACKEND=elli)
run_inets:
(make platform run BACKEND=inets)
run_mochiweb:
(make platform run BACKEND=mochiweb)
run_webmachine:
(make platform run BACKEND=webmachine)
run_yaws:
(make platform run BACKEND=yaws)
run:
erl -pa ebin/ -pa deps/*/ebin \
-config etc/simple_bridge.config \
-simple_bridge backend $(BACKEND) \
-eval "application:start(simple_bridge)"
##### COMMON TEST
test: test_cowboy test_nocowboy
test_nocowboy: test_yaws test_mochiweb test_inets test_webmachine
test_cowboy:
(make test_core BACKEND=cowboy)
test_inets:
(make test_core BACKEND=inets)
test_mochiweb:
(make test_core BACKEND=mochiweb)
test_webmachine:
(make test_core BACKEND=webmachine)
test_yaws:
(make test_core BACKEND=yaws)
clean_test:
(rm -f rebar.test.*.config)
(rm -f test/*.beam)
test_quick:
./rebar --config "rebar.test.$(BACKEND).config" clean
./rebar --config "rebar.test.$(BACKEND).config" get-deps
./rebar --config "rebar.test.$(BACKEND).config" compile
./rebar --config "rebar.test.$(BACKEND).config" skip_deps=true ct
test_core: clean clean_test
(escript rebar_deps/merge_deps.escript rebar.test.config rebar_deps/$(BACKEND).deps rebar.test.$(BACKEND).config)
(cd test; sed "s/BACKEND/$(BACKEND)/" < app.config.src > app.config)
./rebar --config "rebar.test.$(BACKEND).config" get-deps
./rebar --config "rebar.test.$(BACKEND).config" compile
./rebar --config "rebar.test.$(BACKEND).config" skip_deps=true ct
DEPS_PLT=$(CURDIR)/.deps_plt
DEPS=erts kernel stdlib crypto sasl
# removed 'sasl' in attempt to minimize memory usage for Travis
$(DEPS_PLT):
@echo Building local plt at $(DEPS_PLT)
@echo
@## We don't do -r ./deps for this at least until we have a separate
@## dialyzer test for each backend, mostly because webmachine's mochiweb
@## version and mochiweb 2.9 conflict.
@(dialyzer --output_plt $(DEPS_PLT) --build_plt --apps $(DEPS))
dialyzer: $(DEPS_PLT)
@(dialyzer --fullpath --plt $(DEPS_PLT) -Wrace_conditions -r ./ebin)
dialyzer-no-race: $(DEPS_PLT)
@(dialyzer --fullpath --plt $(DEPS_PLT) -r ./ebin)
# TRAVIS-CI STUFF
ERLANG_VERSION_CHECK := erl -eval "io:format(\"~s\",[erlang:system_info(otp_release)]), halt()." -noshell
ERTS_VERSION_CHECK := erl -eval "io:format(\"~s\",[erlang:system_info(version)]), halt()." -noshell
ERLANG_VERSION = $(shell $(ERLANG_VERSION_CHECK))
ERTS_VERSION = $(shell $(ERTS_VERSION_CHECK))
# This is primarily for Travis build testing, as each build instruction will overwrite the previous
travis: compile $(ERLANG_VERSION)
19: test dialyzer
20: test dialyzer
21: test dialyzer
22: test dialyzer
23:
ifeq ($(ERTS_VERSION), 11.0)
@(echo "Skipping Inets. Inets should not be used with Erlang 23.0 (ERTS=$(ERTS_VERSION))")
else
@(echo "Inets is fine with Erlang 23 (ERTS=$(ERTS_VERSION))")
(make test_inets)
endif
(make test_cowboy test_yaws test_mochiweb test_webmachine)