File: Makefile

package info (click to toggle)
ganglia-web 3.7.6%2Bdebian-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,368 kB
  • sloc: javascript: 27,575; php: 17,272; sh: 346; makefile: 82; xml: 42
file content (111 lines) | stat: -rw-r--r-- 3,410 bytes parent folder | download | duplicates (2)
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
##########################################################
# User configurables:
##########################################################
# Location where gweb should be installed to (excluding conf, dwoo dirs).
GDESTDIR = /usr/share/ganglia-webfrontend

# 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

# Name of the user that runs the Apache server 
APACHE_USER = www-data

# Name of the group that runs the Apache server 
APACHE_GROUP = $(APACHE_USER)

# PHP xUnit
PHPUNIT = phpunit

# PHP_CodeSniffer
PHPCS = phpcs

# PHP Code Beautifier and Fixer
PHPCBF = phpcbf
##########################################################

# Gweb version
GWEB_VERSION = 3.7.5

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

# Coding standard
STANDARD = test/phpcs-ganglia-web.xml

CODE = *.php api graph.d lib nagios test

all: default

default:	$(TARGETS)

sniff:
	@$(PHPCS) --version && echo
	$(PHPCS) --standard=$(STANDARD) -p $(CODE)

# convert exclusive standard into inclusive rules
rules:
	@$(PHPCS) --standard=$(STANDARD) -e | grep "^  " | sed -e 's/^  / <rule ref="/' -e 's/$$/"\/>/'

fix:
	$(PHPCBF) --standard=$(STANDARD) $(CODE)

.PHONY: test
test:
	$(PHPUNIT) test

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_GROUP) $(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)