forked from discoproject/disco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
190 lines (143 loc) · 4.34 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
183
184
185
186
187
188
189
190
DISCO_VERSION = 0.5.3
DISCO_RELEASE = 0.5.3
# standard make installation variables
sysconfdir = /etc
prefix = /usr
exec_prefix = $(prefix)
localstatedir = $(prefix)/var
datarootdir = $(prefix)/share
datadir = $(datarootdir)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
SHELL = /bin/sh
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_TREE = cp -r
# relative directory paths
export RELBIN = $(bindir)
export RELLIB = $(libdir)/disco
export RELDAT = $(datadir)/disco
export RELCFG = $(sysconfdir)/disco
export RELSRV = $(localstatedir)/disco
# installation directories
export TARGETBIN = $(DESTDIR)$(RELBIN)
export TARGETLIB = $(DESTDIR)$(RELLIB)
export TARGETDAT = $(DESTDIR)$(RELDAT)
export TARGETCFG = $(DESTDIR)$(RELCFG)
export TARGETSRV = $(DESTDIR)$(RELSRV)
export ABSTARGETLIB = $(RELLIB)
export ABSTARGETSRV = $(RELSRV)
export ABSTARGETDAT = $(RELDAT)
# options to python and sphinx for building the lib and docs
PYTHONENVS = DISCO_VERSION=$(DISCO_VERSION) DISCO_RELEASE=$(DISCO_RELEASE)
SPHINXOPTS = -D version=$(DISCO_VERSION) -D release=$(DISCO_RELEASE)
# utilities used for building disco
DIALYZER = dialyzer
TYPER = typer
PYTHON = python
PY_INSTALL = $(PYTHONENVS) $(PYTHON) setup.py install --root=$(DESTDIR)/ --prefix=$(prefix) $(PY_INSTALL_OPTS)
export WWW = master/www
EBIN = master/ebin
ESRC = master/src
EDEP = master/deps
DEPS = mochiweb lager goldrush folsom bear meck folsomite plists
EDEPS = $(foreach dep,$(DEPS),$(EDEP)/$(dep)/ebin)
ELIBS = $(ESRC) $(ESRC)/ddfs
ESOURCES = $(foreach lib,$(ELIBS),$(wildcard $(lib)/*.erl))
EPLT = .dialyzer_plt
.PHONY: master clean test \
contrib \
dep dep-clean \
debian debian-clean \
doc doc-clean doc-test
.PHONY: install uninstall \
install-core \
install-discodb \
install-examples \
install-master uninstall-master \
install-node uninstall-node \
install-tests
.PHONY: dialyzer dialyzer-clean typer
master: dep
@ (cd master && ./rebar compile)
clean:
@ (cd master && ./rebar clean)
- rm -Rf lib/build lib/disco.egg-info
- find lib -name __pycache__ | xargs rm -rf
xref: master
@ (cd master && ./rebar xref)
erlangtest:
@ (cd master && ./rebar -C eunit.config get-deps compile &&\
./rebar -C eunit.config eunit skip_deps=true && cd -)
pythontest:
@ (cd lib && python setup.py install --user)
@ (cd lib/test && pip install nose --user && PATH=${PATH}:~/.local/bin nosetests)
test: pythontest dialyzer erlangtest
contrib:
git submodule init
git submodule update
dep:
@ (cd master && ./rebar get-deps)
dep-clean:
- rm -Rf master/deps
debian:
$(MAKE) -C pkg/debian
debian-clean:
$(MAKE) -C pkg/debian clean
doc:
$(MAKE) -C doc html -e
doc-clean:
$(MAKE) -C doc clean -e
doc-test:
$(MAKE) -C doc doctest -e
install: install-core install-node install-master
uninstall: uninstall-master uninstall-node
install-core: $(TARGETBIN)/disco $(TARGETBIN)/ddfs
(cd lib && $(PY_INSTALL))
install-discodb: contrib
$(MAKE) -C contrib/discodb install
install-examples: $(TARGETLIB)/examples
install-master: master \
$(TARGETDAT)/$(WWW) \
$(TARGETCFG)/settings.py
uninstall-master:
- rm -Rf $(TARGETDAT)
- rm -f $(TARGETBIN)/disco $(TARGETBIN)/ddfs
- rm -Ri $(TARGETCFG)
install-node: master \
$(TARGETLIB)/$(EBIN) \
$(addprefix $(TARGETLIB)/,$(EDEPS)) \
$(TARGETSRV)
$(TARGETLIB)/$(EBIN):
$(INSTALL) -d $(@D)
$(INSTALL_TREE) $(EBIN) $(@D)
uninstall-node:
- rm -Rf $(TARGETLIB) $(TARGETSRV)
install-tests: $(TARGETLIB)/ext $(TARGETLIB)/tests
dialyzer: $(EPLT) master
$(DIALYZER) --get_warnings -Wno_return -Wunmatched_returns -Werror_handling --plt $(EPLT) -r $(EBIN)
dialyzer-clean:
- rm -Rf $(EPLT)
typer: $(EPLT)
$(TYPER) --plt $(EPLT) -r $(ESRC)
$(EPLT):
$(DIALYZER) --build_plt --output_plt $(EPLT) \
--apps stdlib kernel erts compiler crypto inets syntax_tools
$(TARGETDAT)/% $(TARGETLIB)/%: %
$(INSTALL) -d $(@D)
$(INSTALL_TREE) $< $(@D)
$(TARGETDAT)/$(WWW) $(TARGETLIB)/$(WWW): $(WWW)
$(INSTALL) -d $(@D)
$(INSTALL_TREE) $(WWW) $(@D)
$(TARGETBIN)/disco: bin/disco
$(INSTALL) -d $(@D)
$(INSTALL_PROGRAM) bin/disco $@
$(TARGETBIN)/ddfs: bin/ddfs
$(INSTALL) -d $(@D)
$(INSTALL_PROGRAM) bin/ddfs $@
$(TARGETCFG)/settings.py:
$(INSTALL) -d $(@D)
(cd conf && ./gen.settings.sys-`uname -s` > $@ && chmod 644 $@)
$(TARGETSRV):
$(INSTALL) -d $@