source: branches/1.0/Makefile @ 910

Last change on this file since 910 was 910, checked in by ramonb, 8 years ago

Makefile:

File size: 6.1 KB
Line 
1# Where to build
2#
3TMPDIR = /tmp
4
5# Where to install
6DESTDIR = 
7
8# Install prefix
9PREFIX = /usr/local
10
11BIN_DIR = $(PREFIX)/sbin
12JOBMOND = $(BIN_DIR)/jobmond
13JOBARCHIVED = $(BIN_DIR)/jobarchived
14
15# What is the location of the Ganglia web frontend
16# i.e.: where to we install Job Monarch's web frontend addon
17#
18GANGLIA_ROOT = $(PREFIX)/ganglia
19GANGLIA_USER = ganglia.ganglia
20HTTPD_USER   = apache.apache
21
22# Where jobarchived RRDS are stored
23JOBARCHIVE_RRDS = $(PREFIX)/jobmonarch
24
25# Clear this if you don't want to use ${FAKEROOT}
26#
27FAKEROOT = fakeroot
28
29VERSION = 1.1
30RELEASE = 1
31
32REQUIRED = ./jobarchived ./jobmond ./web
33
34all:    tarball rpm srpm deb
35
36tarball:        tarball-gzip tarball-bzip
37
38tarball-gzip:   ${REQUIRED} ./pkg/rpm/jobmonarch.spec ./debian/changelog
39        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
40        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
41        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
42        ( cd ${TMPDIR}/.monarch_buildroot; tar zcvf ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
43        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
44
45tarball-bzip:   ${REQUIRED} ./pkg/rpm/jobmonarch.spec ./debian/changelog
46        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
47        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
48        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
49        ( cd ${TMPDIR}/.monarch_buildroot; tar jcvf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
50        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
51
52rpmspec: ./pkg/rpm/jobmonarch.spec
53
54./pkg/rpm/jobmonarch.spec: pkg/rpm/jobmonarch.spec.in Makefile
55        sed -e 's/__VERSION__/${VERSION}/g' -e 's/__RELEASE__/${RELEASE}/g' ./pkg/rpm/jobmonarch.spec.in > ./pkg/rpm/jobmonarch.spec
56        @if test -r /etc/debian_version; then \
57                sed -i -e '/BuildRequires/d' ./pkg/rpm/jobmonarch.spec; \
58        fi
59
60rpm: tarball-bzip
61        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
62
63srpm: tarball-bzip
64        rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2
65
66debchangelog: ./debian/changelog
67
68./debian/changelog: ./debian/changelog.in Makefile
69        sed -e 's/__VERSION__/${VERSION}/g' -e 's/__RELEASE__/${RELEASE}/g' ./debian/changelog.in > ./debian/changelog
70
71deb: ${REQUIRED} ./debian ./debian/changelog
72        dpkg-buildpackage -b -uc -us
73
74install:  ${REQUIRED}
75        @#
76        @# Set the correct GANGLIA_PATH.
77        @#
78        @echo
79        @echo "Using $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
80        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
81        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
82        @#
83        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
84        @#
85        @echo
86        @echo "Using $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
87        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
88        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
89        @#
90        @# Files in SBIN_DIR
91        @#
92        @echo
93        @echo "Installing jobmond.py and jobarchived.py to $(PREFIX)/sbin"
94        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin || true
95        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/ || true
96        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/ || true
97        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived) || true
98        @#
99        @# Files specific to distros if /etc/redhat_release => rpm else (/etc/debian_version => debian)
100        @#
101        @echo
102        @echo "Installing service files in /etc"
103        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/deb/init.d/jobmond
104        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/deb/init.d/jobarchived
105        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/rpm/init.d/jobmond
106        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/rpm/init.d/jobarchived
107        @if test -r /etc/redhat_release; then \
108                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
109                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
110                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
111                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
112                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
113                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
114        else \
115                install -m 0755 -d $(DESTDIR)/etc/init.d; \
116                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
117                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
118                install -m 0755 -d $(DESTDIR)/etc/default; \
119                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
120                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
121        fi
122        @#
123        @# Files in /etc
124        @#
125        @echo
126        @echo "Installing config files jobmond.conf jobarchived.conf in /etc"
127        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
128        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
129        @#
130        @# Files in /usr/share
131        @#
132        @echo
133        @echo "Installing job_dbase.sql in $(PREFIX)/share/jobarchived"
134        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
135        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
136        @#
137        @# Create the /var/lib/jobarchive directory where rrds are stored.
138        @#
139        @echo
140        @echo "Creating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
141        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
142        @#
143        @# Files for ganglia
144        @#
145        @echo
146        @echo "Installing Ganglia web interface to $(GANGLIA_ROOT) ."
147        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
148        @chown -R $(GANGLIA_USER) ./web
149        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
150        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
151        @chmod 775 ./web/addons/job_monarch/dwoo/cache
152        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
153        @#
154        @echo
155        @echo "Installation complete."
156        @echo
157
158clean:
159        @rm -rf ${TMPDIR}/.monarch_buildroot
160        @rm -rf ./pkg/rpm/jobmonarch.spec
161        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
162        @rm -f web/addons/job_monarch/conf.php
Note: See TracBrowser for help on using the repository browser.