forked from maranda/metronome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (79 loc) · 3.01 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
include config.unix
BIN = $(DESTDIR)$(PREFIX)/bin
CONFIG = $(DESTDIR)$(SYSCONFDIR)
MODULES = $(DESTDIR)$(PREFIX)/lib/metronome/modules
SOURCE = $(DESTDIR)$(PREFIX)/lib/metronome
DATA = $(DESTDIR)$(DATADIR)
INSTALLEDSOURCE = $(PREFIX)/lib/metronome
INSTALLEDCONFIG = $(SYSCONFDIR)
INSTALLEDMODULES = $(PREFIX)/lib/metronome/modules
INSTALLEDDATA = $(DATADIR)
.PHONY: all clean install upgrade uninstall
all: metronome.install metronomectl.install metronome.cfg.lua.install metronome.version
$(MAKE) -C util-src install
$(MAKE) -C certs localhost.cnf
$(MAKE) -C certs localhost.key
$(MAKE) -C certs localhost.cert
clean:
rm -f metronome.install
rm -f metronomectl.install
rm -f metronome.cfg.lua.install
rm -f metronome.version
$(MAKE) clean -C util-src
install: metronome.install metronomectl.install metronome.cfg.lua.install metronome.version util/encodings.so util/encodings.so util/pposix.so util/signal.so
install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
install -m750 -d $(DATA)
install -d $(CONFIG)/certs
install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
install -m755 ./metronome.install $(BIN)/metronome
install -m755 ./metronomectl.install $(BIN)/metronomectl
install -m644 core/* $(SOURCE)/core
install -m644 net/*.lua $(SOURCE)/net
install -d $(SOURCE)/net/http
install -m644 net/http/*.lua $(SOURCE)/net/http
install -m644 util/*.lua $(SOURCE)/util
install -m644 util/*.so $(SOURCE)/util
install -d $(SOURCE)/util/sasl
install -m644 util/sasl/* $(SOURCE)/util/sasl
umask 0022 && cp -r plugins/* $(MODULES)
install -m644 certs/* $(CONFIG)/certs
test -e $(CONFIG)/metronome.cfg.lua || install -m644 metronome.cfg.lua.install $(CONFIG)/metronome.cfg.lua
test -e metronome.version && install metronome.version $(SOURCE)/metronome.version || true
$(MAKE) install -C util-src
git-upgrade:
@sleep 5
git stash
git pull
$(MAKE) clean
$(MAKE) all
sudo $(MAKE) install
hg-upgrade:
@sleep 5
hg pull -u
$(MAKE) clean
$(MAKE) all
sudo $(MAKE) install
uninstall:
rm -rf $(SOURCE)
rm -rf $(MODULES)
rm -f $(BIN)/metronome
rm -f $(BIN)/metronomectl
upgrade:
@echo "****************************************************************************"
@echo "* Please remember that you may have to reload the changed modules and / or"
@echo "* restart Metronome after."
@echo "****************************************************************************"
@if [ -d .git ]; then $(MAKE) git-upgrade; else $(MAKE) hg-upgrade; fi
util/%.so:
$(MAKE) install -C util-src
%.install: %
sed "s|^#!\/usr\/bin\/env lua$$|#!\/usr\/bin\/env lua$(LUA_SUFFIX)|; \
s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \
s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \
s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < $^ > $@
metronome.cfg.lua.install: metronome.cfg.lua.dist
sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@
metronome.version: $(wildcard metronome.release)
test -f metronome.release && \
cp metronome.release $@ || true