forked from basho/riak_cs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
182 lines (139 loc) · 4.87 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
177
178
179
180
181
182
REPO ?= riak_cs
PKG_REVISION ?= $(shell git describe --tags)
PKG_VERSION ?= $(shell git describe --tags | tr - .)
PKG_ID = riak-cs-$(PKG_VERSION)
PKG_BUILD = 1
BASE_DIR = $(shell pwd)
ERLANG_BIN = $(shell dirname $(shell which erl))
REBAR ?= $(BASE_DIR)/rebar
OVERLAY_VARS ?=
CS_HTTP_PORT ?= 8080
.PHONY: rel stagedevrel deps test
all: deps compile
compile:
@./rebar compile
compile-client-test: all
@./rebar client_test_compile
compile-int-test: all
@./rebar int_test_compile
compile-riak-test: all
@./rebar riak_test_compile
## There are some Riak CS internal modules that our riak_test
## test would like to use. But riak_test doesn't have a nice
## way of adding the -pz argument + code path that we need.
## So we'll copy the BEAM files to a place that riak_test is
## already using.
cp -v ebin/riak_cs_wm_utils.beam riak_test/ebin
clean-client-test:
@./rebar client_test_clean
clean-int-test:
@./rebar int_test_clean
clean-riak-test:
@./rebar riak_test_clean
deps:
@./rebar get-deps
clean:
@./rebar clean
distclean: clean
@./rebar delete-deps
@rm -rf $(PKG_ID).tar.gz
test: all
@./rebar skip_deps=true eunit
test-client: test-clojure test-python test-erlang
test-python: test-boto
test-boto:
env CS_HTTP_PORT=${CS_HTTP_PORT} python client_tests/python/boto_test.py
test-erlang: compile-client-test
@./rebar skip_deps=true client_test_run
test-clojure:
@command -v lein >/dev/null 2>&1 || { echo >&2 "I require lein but it's not installed. \
Please read client_tests/clojure/clj-s3/README."; exit 1; }
@cd client_tests/clojure/clj-s3 && lein do deps, midje
test-int: compile-int-test
@./rebar skip_deps=true int_test_run
##
## Release targets
##
rel: deps compile
@./rebar generate skip_deps=true $(OVERLAY_VARS)
relclean:
rm -rf rel/riak-cs
##
## Developer targets
##
stage : rel
$(foreach dep,$(wildcard deps/*), rm -rf rel/riak-cs/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) rel/riak-cs/lib;)
$(foreach app,$(wildcard apps/*), rm -rf rel/riak-cs/lib/$(shell basename $(app))-* && ln -sf $(abspath $(app)) rel/riak-cs/lib;)
devrel: dev1 dev2 dev3 dev4
dev1 dev2 dev3 dev4: all
mkdir -p dev
(cd rel && ../rebar generate skip_deps=true target_dir=../dev/$@ overlay_vars=vars/$@_vars.config)
stagedevrel: dev1 dev2 dev3 dev4
$(foreach dev,$^, \
$(foreach app,$(wildcard apps/*), rm -rf dev/$(dev)/lib/$(shell basename $(app))-* && ln -sf $(abspath $(app)) dev/$(dev)/lib;) \
$(foreach dep,$(wildcard deps/*), rm -rf dev/$(dev)/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) dev/$(dev)/lib;))
rtdevrel: rtdev1 rtdev2 rtdev3 rtdev4 rtdev5 rtdev6
rtdev1 rtdev2 rtdev3 rtdev4 rtdev5 rtdev6:
$(if $(RT_TARGET_CS),,$(error "RT_TARGET_CS var not set, see riak_test/ directory for details"))
mkdir -p $(RT_TARGET_CS)/$@
(cd rel && ../rebar generate skip_deps=true target_dir=$(RT_TARGET_CS)/$@ overlay_vars=vars/$@_vars.config)
devclean: clean
rm -rf dev
##
## Doc targets
##
docs:
./rebar skip_deps=true doc
orgs: orgs-doc orgs-README
orgs-doc:
@emacs -l orgbatch.el -batch --eval="(riak-export-doc-dir \"doc\" 'html)"
orgs-README:
@emacs -l orgbatch.el -batch --eval="(riak-export-doc-file \"README.org\" 'ascii)"
@mv README.txt README
APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
xmerl webtool eunit syntax_tools compiler
PLT = $(HOME)/.riak-cs_dialyzer_plt
check_plt: compile
dialyzer --check_plt --plt $(PLT) --apps $(APPS)
build_plt: compile
dialyzer --build_plt --output_plt $(PLT) --apps $(APPS)
dialyzer: compile
@echo
@echo Use "'make check_plt'" to check PLT prior to using this target.
@echo Use "'make build_plt'" to build PLT prior to using this target.
@echo
@sleep 1
dialyzer -Wno_return -Wunmatched_returns --plt $(PLT) deps/*/ebin ebin | \
tee .dialyzer.raw-output | egrep -v -f ./dialyzer.ignore-warnings
cleanplt:
@echo
@echo "Are you sure? It takes about 1/2 hour to re-build."
@echo Deleting $(PLT) in 5 seconds.
@echo
sleep 5
rm $(PLT)
xref: compile
./rebar xref skip_deps=true | grep -v unused | egrep -v -f ./xref.ignore-warnings
##
## Packaging targets
##
.PHONY: package
export PKG_VERSION PKG_ID PKG_BUILD BASE_DIR ERLANG_BIN REBAR OVERLAY_VARS RELEASE
package.src: deps
mkdir -p package
rm -rf package/$(PKG_ID)
git archive --format=tar --prefix=$(PKG_ID)/ $(PKG_REVISION)| (cd package && tar -xf -)
make -C package/$(PKG_ID) deps
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: distclean
rm -rf package