forked from OpenACD/OpenACD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
129 lines (114 loc) · 2.97 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
SHELL := /bin/bash
TARBALL = $(abspath $(DESTDIR)OpenACD.tar.gz)
tarballfiles = attic \
contrib \
deps \
doc \
include_apps \
misc \
priv \
include \
rel \
src \
tests \
LICENSE \
Makefile \
README.markdown \
buildcerts.sh \
devboot \
gen-cpx.config.sample \
hooks.sh \
openacd.spec \
rebar \
rebar.config \
success_message \
install.sh \
config \
scripts \
apps
MACHINE := $(shell uname -m)
ifeq ($(MACHINE), x86_64)
libdir = lib64
endif
ifeq ($(MACHINE), i686)
libdir = lib
endif
BINDIR=/bin
ETCDIR=/etc
LIBDIR=/$(libdir)
VARDIR=/var
OADIR=$(LIBDIR)/openacd
OALIBDIR=$(OADIR)/lib
OABINDIR=$(OADIR)/bin
OACONFIGDIR=$(ETCDIR)/openacd
OAVARDIR=$(VARDIR)/lib/openacd
OALOGDIR=$(VARDIR)/log/openacd
OADBDIR=$(OAVARDIR)/db
OAPLUGINDIR=$(OADIR)/plugin.d
ifdef PREFIX
OPENACD_PREFIX=$(PREFIX)
else
OPENACD_PREFIX=/
endif
all: deps compile
deps:
./rebar get-deps update-deps
compile:
mkdir -p ./ebin
./rebar compile generate force=1
clean:
./rebar clean
rm -f $(TARBALL)
rm -rf tarball
rm -rf OpenACD
run: compile
./rel/openacd/bin/openacd console
install: compile
mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OADIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OALIBDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OABINDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OACONFIGDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OAVARDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OAPLUGINDIR)
for dep in deps/*; do \
./install.sh $$dep $(DESTDIR)$(PREFIX)$(OALIBDIR) ; \
done
./install.sh . $(DESTDIR)$(PREFIX)$(OALIBDIR)
for app in ./include_apps/*; do \
./install.sh $$app $(DESTDIR)$(PREFIX)$(OALIBDIR) ; \
done
## Plug-ins
mkdir -p $(DESTDIR)$(PREFIX)$(OAPLUGINDIR)
## Configurations
sed \
-e 's|%LOG_DIR%|$(OALOGDIR)|g' \
-e 's|%PLUGIN_DIR%|$(PREFIX)$(OAPLUGINDIR)|g' \
-e 's|%KEY_DIR%|$(PREFIX)$(OACONFIGDIR)|g' \
./config/app.config > $(DESTDIR)$(PREFIX)$(OACONFIGDIR)/app.config
sed \
-e 's|%DB_DIR%|$(PREFIX)$(OADBDIR)|g' \
./config/vm.args > $(DESTDIR)$(PREFIX)$(OACONFIGDIR)/vm.args
## Var dirs
mkdir -p $(DESTDIR)$(PREFIX)$(OADBDIR)
mkdir -p $(DESTDIR)$(PREFIX)$(OALOGDIR)
## Bin
#dont use DESTDIR in sed here;this is a hack to not get "rpmbuild found in installed files"
sed \
-e 's|%OPENACD_PREFIX%|"$(OPENACD_PREFIX)"|g' \
-e 's|%LIB_DIR%|$(libdir)|g' \
./scripts/openacd > $(DESTDIR)$(PREFIX)$(OABINDIR)/openacd
chmod +x $(DESTDIR)$(PREFIX)$(OABINDIR)/openacd
cp ./scripts/nodetool $(DESTDIR)$(PREFIX)$(OABINDIR)
cd $(DESTDIR)$(PREFIX)$(BINDIR); \
ln -sf $(PREFIX)$(OABINDIR)/openacd openacd; \
ln -sf $(PREFIX)$(OABINDIR)/nodetool nodetool
dist: deps
./hooks.sh pre_compile
mkdir -p tarball/OpenACD
rsync -aC $(tarballfiles) tarball/OpenACD
rm -rf tarball/OpenACD/deps/protobuffs/cover.spec
cd tarball && tar -czf $(TARBALL) OpenACD
rpm: dist
QA_RPATHS=0x0003 rpmbuild -tb $(TARBALL)
.PHONY: all deps compile clean run install dist rpm