forked from discoproject/disco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (78 loc) · 2.96 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
#OPT = -W +native +"{hipe, [o3]}"
OPT = -W
CC = erlc
PYTHON = python
ESRC = master/src
EBIN = master/ebin
DESTDIR=/
PREFIX=/usr
SYSCONFDIR=/etc
BIN_DIR = $(PREFIX)/bin/
INSTALL_DIR = $(PREFIX)/lib/disco/
CONFIG_DIR = $(SYSCONFDIR)/disco/
TARGETDIR = $(DESTDIR)/$(INSTALL_DIR)
TARGETBIN = $(DESTDIR)/$(BIN_DIR)
TARGETCFG = $(DESTDIR)/$(CONFIG_DIR)
SRC = $(wildcard $(ESRC)/*.erl)
TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(SRC)))))
SRC2 = $(wildcard $(ESRC)/mochiweb/*.erl)
MOCHI_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/mochiweb/, $(notdir $(SRC2)))))
SRC3 = $(wildcard $(ESRC)/ddfs/*.erl)
DDFS_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/ddfs/, $(notdir $(SRC3)))))
UNAME = $(shell uname)
build: master config
master: $(EBIN)/ddfs $(EBIN)/mochiweb $(TARGET) $(MOCHI_TARGET) $(DDFS_TARGET)
clean:
- rm -Rf master/ebin/*.beam
- rm -Rf master/ebin/mochiweb/*.beam
- rm -Rf master/ebin/ddfs/*.beam
- rm -Rf pydisco/build
- rm -Rf pydisco/disco.egg-info
- rm -Rf node/build
- rm -Rf node/disco_node.egg-info
install: install-master install-pydisco install-node
install-ebin:
install -d $(TARGETDIR)/ebin $(TARGETDIR)/ebin/ddfs $(TARGETDIR)/ebin/mochiweb
install -m 0755 $(TARGET) $(TARGETDIR)/ebin
install -m 0755 $(MOCHI_TARGET) $(TARGETDIR)/ebin/mochiweb
install -m 0755 $(DDFS_TARGET) $(TARGETDIR)/ebin/ddfs
install-master: master install-ebin install-config install-bin
install -m 0755 master/ebin/disco.app $(TARGETDIR)/ebin
install -m 0755 master/make-lighttpd-proxyconf.py $(TARGETDIR)
cp -r master/www $(TARGETDIR)
chmod -R u=rwX,g=rX,o=rX $(TARGETDIR)/www
$(if $(wildcard $(TARGETCFG)/lighttpd-master.conf),\
$(info lighttpd-master config already exists, skipping),\
install -m 0644 conf/lighttpd-master.conf $(TARGETCFG))
install-node: master install-ebin install-config install-bin
install -m 0755 node/disco-worker $(TARGETBIN)
$(if $(wildcard $(TARGETCFG)/lighttpd-worker.conf),\
$(info lighttpd-worker config already exists, skipping),\
install -m 0644 conf/lighttpd-worker.conf $(TARGETCFG))
install-bin:
install -d $(TARGETBIN)
install -m 0755 bin/disco.py $(TARGETBIN)/disco
install-pydisco:
(cd pydisco; $(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PREFIX))
install-config:
install -d $(TARGETCFG)
$(if $(wildcard $(TARGETCFG)/settings.py),\
$(info disco config already exists, skipping),\
install -m 0644 conf/settings.py.sys-$(UNAME) $(TARGETCFG)/settings.py)
$(EBIN)/mochiweb/%.beam: $(ESRC)/mochiweb/%.erl
$(CC) $(OPT) -o $(EBIN)/mochiweb/ $<
$(EBIN)/ddfs/%.beam: $(ESRC)/ddfs/%.erl
$(CC) $(OPT) -o $(EBIN)/ddfs/ $<
$(EBIN)/%.beam: $(ESRC)/%.erl
$(CC) $(OPT) -o $(EBIN) $<
$(EBIN)/ddfs:
- mkdir $(EBIN)/ddfs
$(EBIN)/mochiweb:
- mkdir $(EBIN)/mochiweb
config:
$(if $(wildcard conf/settings.py),\
$(info not overwriting existing conf/settings.py),\
cp conf/settings.py.template conf/settings.py)