-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
111 lines (85 loc) · 3.21 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
# Most of this Makefile depends upon Basho's work. See
# https://github.com/basho/riak &
# https://github.com/basho/node_package
REBAR = rebar
OVERLAY_VARS ?=
.PHONY: deps docs
all: deps compile
capability: pfkeyport
sudo setcap cap_net_admin=ep apps/pf_key/priv/pfkeyport
export EXOMETER_PACKAGES="(basic)"
compile:
$(REBAR) compile
deps:
$(REBAR) get-deps
clean: docsclean
$(REBAR) clean
rm -f pfkeyport
distclean: clean relclean docsclean pkgclean
$(REBAR) delete-deps
rel: all relclean
$(REBAR) generate $(OVERLAY_VARS)
lint:
elvis rock
relclean:
rm -rf rel/sesame
xref:
$(REBAR) skip_deps=true xref
DIALYZER_APPS = erts kernel stdlib sasl common_test eunit tools runtime_tools \
syntax_tools compiler debugger inets os_mon
PLT = $(HOME)/dialyzer/sesame_plt
plt:
@# Regarding the initial '-', this *always* warns & we're fine with that.
@# Cf. https://www.gnu.org/software/make/manual/html_node/Errors.html
@# We remove some deps for being unreliable in terms of specs.
-mkdir $(HOME)/dialyzer
-test ! -f "$(PLT)" && ( dialyzer --build_plt --output_plt $(PLT) \
--apps $(DIALYZER_APPS) \
-r deps \
--statistics --verbose ; \
dialyzer --remove_from_plt --plt $(PLT) \
--statistics --verbose \
-r deps/exometer deps/exometer_core deps/recon )
dialyze: plt
@# Some of riak_core still doesn't define -callback specs, so we ignore
@# that warning.
dialyzer --plt $(PLT) -Wno_undefined_callbacks \
--statistics --verbose apps/*/ebin
# To test a specific app / module, use e.g.
# rebar apps=$APP skip_deps=true eunit suites=$MODULE
eunit:
$(REBAR) skip_deps=true eunit
tests: compile xref dialyze eunit
docs: docsclean
$(REBAR) skip_deps=true doc
cp apps/sesame/doc/*.png apps/sesame/edoc
docsclean:
rm -rf apps/*/edoc
stage : rel
$(foreach dep,$(wildcard deps/*), rm -rf rel/sesame/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) rel/sesame/lib;)
$(foreach app,$(wildcard apps/*), rm -rf rel/sesame/lib/$(shell basename $(app))-* && ln -sf $(abspath $(app)) rel/sesame/lib;)
## node_package packaging config, cf. https://github.com/basho/node_package
.PHONY: package
PKG_VERSION=0.${CIRCLE_BUILD_NUM}
PKG_ID=sesame-${PKG_VERSION}
export PKG_VERSION PKG_ID REBAR OVERLAY_VARS
package.src: deps
mkdir -p package
rm -rf package/$(PKG_ID)
git archive --format=tar --prefix=$(PKG_ID)/ HEAD | (cd package && tar -xf -)
${MAKE} -C package/$(PKG_ID) deps
mkdir -p package/$(PKG_ID)/priv
#git --git-dir=.git describe --tags >package/$(PKG_ID)/priv/vsn.git
for dep in package/$(PKG_ID)/deps/*; do \
echo "Processing dep: $${dep}"; \
mkdir -p $${dep}/priv; \
git --git-dir=$${dep}/.git describe --tags >$${dep}/priv/vsn.git; \
done
find package/$(PKG_ID) -depth -name ".git" -exec rm -rf {} \;
tar -C package -czf package/$(PKG_ID).tar.gz $(PKG_ID)
dist: package.src
cp package/$(PKG_ID).tar.gz .
package: package.src
${MAKE} -C package -f $(PKG_ID)/deps/node_package/Makefile
pkgclean:
rm -rf package