forked from aeternity/aeternity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
176 lines (126 loc) · 3.52 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
CORE = rel/epoch/bin/epoch
VER := $(shell cat VERSION)
PYTHON_DIR = py
PYTHON_BIN = $(PYTHON_DIR)/bin
NOSE = $(PYTHON_BIN)/nosetests
PYTHON = $(PYTHON_BIN)/python
PYTHON_TESTS = $(PYTHON_DIR)/tests
PIP = $(PYTHON_BIN)/pip
HTTP_APP = apps/aehttp
SWTEMP := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
local-build: KIND=local
local-build: internal-build
local-start: KIND=local
local-start: internal-start
local-stop: KIND=local
local-stop: internal-stop
local-attach: KIND=local
local-attach: internal-attach
prod-build: KIND=prod
prod-build: internal-build
prod-start: KIND=prod
prod-start: internal-start
prod-stop: KIND=prod
prod-stop: internal-stop
prod-attach: KIND=prod
prod-attach: internal-attach
multi-start:
@make dev1-start
@make dev2-start
@make dev3-start
multi-stop:
@make dev1-stop
@make dev2-stop
@make dev3-stop
multi-clean:
@make dev1-clean
@make dev2-clean
@make dev3-clean
dev1-build: KIND=dev1
dev1-build: internal-build
dev1-start: KIND=dev1
dev1-start: internal-start
dev1-stop: KIND=dev1
dev1-stop: internal-stop
dev1-attach: KIND=dev1
dev1-attach: internal-attach
dev1-clean: KIND=dev1
dev1-clean: internal-clean
dev2-start: KIND=dev2
dev2-start: internal-start
dev2-stop: KIND=dev2
dev2-stop: internal-stop
dev2-attach: KIND=dev2
dev2-attach: internal-attach
dev2-clean: KIND=dev2
dev2-clean: internal-clean
dev3-start: KIND=dev3
dev3-start: internal-start
dev3-stop: KIND=dev3
dev3-stop: internal-stop
dev3-attach: KIND=dev3
dev3-attach: internal-attach
dev3-clean: KIND=dev3
dev3-clean: internal-clean
dialyzer:
@./rebar3 dialyzer
test:
@./rebar3 do eunit,ct
venv-present:
@virtualenv -q $(PYTHON_DIR)
nose-env: venv-present
@. $(PYTHON_BIN)/activate && $(PIP) -q install -r $(PYTHON_DIR)/requirements.txt
python-tests:
@$(NOSE) --nocapture -c $(PYTHON_TESTS)/nose.cfg $(PYTHON_TESTS)
swagger: config/swagger.yaml
@swagger-codegen generate -i $< -l erlang-server -o $(SWTEMP)
@echo "Swagger tempdir: $(SWTEMP)"
@cp $(SWTEMP)/priv/swagger.json $(HTTP_APP)/priv/
@cp $(SWTEMP)/src/*.erl $(HTTP_APP)/src/swagger
@rm -fr $(SWTEMP)
swagger-python: config/swagger.yaml
@swagger-codegen generate -i $< -l python -o $(SWTEMP)
@echo "Swagger python tempdir: $(SWTEMP)"
@cp -r $(SWTEMP)/swagger_client $(PYTHON_TESTS)
@rm -fr $(SWTEMP)
kill:
@echo "Kill all beam processes only from this directory tree"
$(shell pkill -9 -f ".*/beam.*-boot `pwd`" || true)
killall:
@echo "Kill all beam processes from this host"
@pkill -9 beam || true
clean:
@./rebar3 clean
multi-build: dev1-build
@rm -rf _build/dev2 _build/dev3
@for x in dev2 dev3; do \
cp -R _build/dev1 _build/$$x; \
cp config/$$x/sys.config _build/$$x/rel/epoch/releases/$(VER)/sys.config; \
cp config/$$x/vm.args _build/$$x/rel/epoch/releases/$(VER)/vm.args; \
done
#
# Build rules
#
.SECONDEXPANSION:
internal-build: $$(KIND)
@./rebar3 as $(KIND) release
internal-start: $$(KIND)
@./_build/$(KIND)/$(CORE) start
internal-stop: $$(KIND)
@./_build/$(KIND)/$(CORE) stop
internal-attach: $$(KIND)
@./_build/$(KIND)/$(CORE) attach
internal-clean: $$(KIND)
@rm -rf ./_build/$(KIND)/rel/epoch/data/*
@rm -rf ./_build/$(KIND)/rel/epoch/blocks/*
@rm -rf ./_build/$(KIND)/rel/*/log/*
.PHONY: \
local-build local-start local-stop local-attach \
prod-build prod-start prod-stop prod-attach \
multi-build, multi-start, multi-stop, multi-clean \
dev1-start, dev1-stop, dev1-attach, dev1-clean \
dev2-start, dev2-stop, dev2-attach, dev2-clean \
dev3-start, dev3-stop, dev3-attach, dev3-clean \
dialyzer \
test \
kill killall \