-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (46 loc) · 1.72 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
REBAR = $(shell pwd)/rebar
.PHONY: deps
all: deps compile
compile:
$(REBAR) compile
deps:
$(REBAR) get-deps
clean:
$(REBAR) clean
distclean: clean devclean relclean
$(REBAR) delete-deps
rel: all
$(REBAR) generate
relclean:
rm -rf rel/crdtdb
xref: all
$(REBAR) skip_deps=true xref
stage : rel
$(foreach dep,$(wildcard deps/*), rm -rf rel/crdtdb/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) rel/crdtdb/lib;)
$(foreach app,$(wildcard apps/*), rm -rf rel/crdtdb/lib/$(shell basename $(app))-* && ln -sf $(abspath $(app)) rel/crdtdb/lib;)
rm -rf rel/crdtdb/lib/crdtdb-1/ebin && ln -sf $(abspath ebin) rel/crdtdb/lib/crdtdb-1/ebin
##
## Developer targets
##
## devN - Make a dev build for node N
## stagedevN - Make a stage dev build for node N (symlink libraries)
## devrel - Make a dev build for 1..$DEVNODES
## stagedevrel Make a stagedev build for 1..$DEVNODES
##
## Example, make a 68 node devrel cluster
## make stagedevrel DEVNODES=68
.PHONY : stagedevrel devrel
DEVNODES ?= 4
# 'seq' is not available on all *BSD, so using an alternate in awk
SEQ = $(shell awk 'BEGIN { for (i = 1; i < '$(DEVNODES)'; i++) printf("%i ", i); print i ;exit(0);}')
$(eval stagedevrel : $(foreach n,$(SEQ),stagedev$(n)))
$(eval devrel : $(foreach n,$(SEQ),dev$(n)))
dev% : all
mkdir -p dev
rel/gen_dev $@ rel/vars/dev_vars.config.src rel/vars/$@_vars.config
(cd rel && $(REBAR) generate target_dir=../dev/$@ overlay_vars=vars/$@_vars.config)
stagedev% : dev%
$(foreach dep,$(wildcard deps/*), rm -rf dev/$^/lib/$(shell basename $(dep))* && ln -sf $(abspath $(dep)) dev/$^/lib;)
$(foreach app,$(wildcard apps/*), rm -rf dev/$^/lib/$(shell basename $(app))* && ln -sf $(abspath $(app)) dev/$^/lib;)
devclean: clean
rm -rf dev