forked from ganglia/ganglia-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (61 loc) · 2.8 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
##########################################################
# User configurables:
##########################################################
# Location where gweb should be installed to (excluding conf, dwoo dirs).
GDESTDIR = /var/www/html/ganglia
# Location where default apache configuration should be installed to.
GCONFDIR = /etc/ganglia-web
# Gweb statedir (where conf dir and Dwoo templates dir are stored)
GWEB_STATEDIR = /var/lib/ganglia-web
# Gmetad rootdir (parent location of rrd folder)
GMETAD_ROOTDIR = /var/lib/ganglia
APACHE_USER = apache
##########################################################
# Gweb version
GWEB_MAJOR_VERSION = 3
GWEB_MINOR_VERSION = 5
GWEB_MICRO_VERSION = 10
GWEB_VERSION = $(GWEB_MAJOR_VERSION).$(GWEB_MINOR_VERSION).$(GWEB_MICRO_VERSION)
DIST_NAME = ganglia-web
DIST_DIR = $(DIST_NAME)-$(GWEB_VERSION)
DIST_TARBALL = $(DIST_DIR).tar.gz
TARGETS = conf_default.php ganglia-web.spec version.php apache.conf
all: default
default: $(TARGETS)
clean:
rm -rf $(TARGETS) $(DIST_DIR) $(DIST_TARBALL) rpmbuild
conf_default.php: conf_default.php.in
sed -e "s|@vargmetadir@|$(GMETAD_ROOTDIR)|" -e "s|@vargwebstatedir@|$(GWEB_STATEDIR)|g" conf_default.php.in > conf_default.php
ganglia-web.spec: ganglia-web.spec.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ -e "s|@vargwebdir@|$(GWEB_STATEDIR)|" -e "s|@varapacheuser@|$(APACHE_USER)|g" -e "s|@etcdir@|$(GCONFDIR)|g" ganglia-web.spec.in > ganglia-web.spec
version.php: version.php.in
sed -e s/@GWEB_VERSION@/$(GWEB_VERSION)/ version.php.in > version.php
apache.conf: apache.conf.in
sed -e "s|@GDESTDIR@|$(GDESTDIR)|g" apache.conf.in > apache.conf
dist-dir: default
rsync --exclude "rpmbuild" --exclude "*.gz" --exclude "Makefile" --exclude "*debian*" --exclude "$(DIST_DIR)" --exclude ".git*" --exclude "*.in" --exclude "*~" --exclude "#*#" --exclude "ganglia-web.spec" --exclude "apache.conf" -a . $(DIST_DIR)
install: dist-dir
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/compiled && \
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR)/dwoo/cache && \
mkdir -p $(DESTDIR)/$(GWEB_STATEDIR) && \
rsync -a $(DIST_DIR)/conf $(DESTDIR)/$(GWEB_STATEDIR) && \
mkdir -p $(DESTDIR)/$(GDESTDIR) && \
rsync --exclude "conf" -a $(DIST_DIR)/* $(DESTDIR)/$(GDESTDIR) && \
chown -R $(APACHE_USER):$(APACHE_USER) $(DESTDIR)/$(GWEB_STATEDIR)
dist-gzip: dist-dir
if [ -f $(DIST_TARBALL) ]; then \
rm -rf $(DIST_TARBALL) ;\
fi ;\
tar -czf $(DIST_TARBALL) $(DIST_DIR)/*
rpm: dist-gzip ganglia-web.spec apache.conf
rm -rf rpmbuild
mkdir rpmbuild
mkdir rpmbuild/SOURCES
mkdir rpmbuild/BUILD
mkdir rpmbuild/RPMS
mkdir rpmbuild/SRPMS
cp $(DIST_TARBALL) rpmbuild/SOURCES
cp apache.conf rpmbuild/SOURCES
rpmbuild --define '_topdir $(PWD)/rpmbuild' --define 'custom_web_prefixdir $(GDESTDIR)' -bb ganglia-web.spec
uninstall:
rm -rf $(DESTDIR)/$(GDESTDIR) $(DESTDIR)/$(GWEB_STATEDIR)