source: branches/1.1/Makefile

Last change on this file was 974, checked in by olahaye, 7 years ago

[Makefile] Fix rpm: rule. --with => --define.

File size: 6.8 KB
RevLine 
[472]1# Where to build
2#
[378]3TMPDIR = /tmp
4
[841]5# Where to install
6DESTDIR = 
[485]7
[841]8# Install prefix
9PREFIX = /usr/local
10
[907]11BIN_DIR = $(PREFIX)/sbin
12JOBMOND = $(BIN_DIR)/jobmond
13JOBARCHIVED = $(BIN_DIR)/jobarchived
14
[472]15# What is the location of the Ganglia web frontend
16# i.e.: where to we install Job Monarch's web frontend addon
17#
[841]18GANGLIA_ROOT = $(PREFIX)/ganglia
[844]19GANGLIA_USER = ganglia.ganglia
20HTTPD_USER   = apache.apache
[472]21
[841]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
[954]29VERSION = 1.1.2
[378]30RELEASE = 1
31
32REQUIRED = ./jobarchived ./jobmond ./web
33
[915]34all:
35        @echo "Nothing to build."
36        @echo "possible targets are: tarball, tarball-gzip, tarball-bzip, rpm, srpm, deb, clean"
[378]37
[904]38tarball:        tarball-gzip tarball-bzip
[378]39
[913]40$(TMPDIR)/.monarch_buildroot: ${REQUIRED} Makefile
[915]41        @rm -rf ${TMPDIR}/.monarch_buildroot
[913]42        @mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
[917]43        @( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php --exclude=svn-commit.tmp \
[904]44        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
[913]45        @sed -i -e 's|__VERSION__|$(VERSION)|g' -e 's/__RELEASE__/$(RELEASE)/g' \
46                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobmond/jobmond.py \
47                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/jobarchived/jobarchived.py \
48                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/web/addons/job_monarch/version.php \
49                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/pkg/rpm/jobmonarch.spec \
50                ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}/debian/changelog
[378]51
52
[913]53tarball-gzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
[916]54        @( cd ${TMPDIR}/.monarch_buildroot; tar zcf $(TMPDIR)/ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
[918]55        @mv -f ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.gz .. 2> /dev/null || true
[913]56        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.gz"
[953]57        @rm -rf $(TMPDIR)/.monarch_buildroot
[840]58
[913]59tarball-bzip:   $(TMPDIR)/.monarch_buildroot ${REQUIRED}
[916]60        @( cd ${TMPDIR}/.monarch_buildroot; tar jcf ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
[918]61        @mv -f ${TMPDIR}/ganglia_jobmonarch-${VERSION}.tar.bz2 .. 2> /dev/null || true
[913]62        @echo "Wrote: ../ganglia_jobmonarch-${VERSION}.tar.bz2"
[953]63        @rm -rf $(TMPDIR)/.monarch_buildroot
[841]64
[840]65rpm: tarball-bzip
[913]66        # Binary package will reflect most distro where ganglia default location is /usr/share/ganglia
[974]67        @LC_ALL=C rpmbuild -tb --define 'web_prefixdir /usr/share/ganglia-webfrontend' ../ganglia_jobmonarch-${VERSION}.tar.bz2|grep "Wrote: "
[840]68
[844]69srpm: tarball-bzip
[916]70        @LC_ALL=C rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2|grep "Wrote: "
[844]71
[913]72deb: ${REQUIRED} $(TMPDIR)/.monarch_buildroot ./debian
[914]73        @( cd ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}; dpkg-buildpackage -b -uc -us )
[916]74        @mv ${TMPDIR}/.monarch_buildroot/jobmonarch-*_$(VERSION)-$(RELEASE)_all.deb ..
[913]75        @rm -rf ${TMPDIR}/.monarch_buildroot
76        @echo "Wrote:"
[914]77        @ls -1 ../jobmonarch*$(VERSION)*.deb
[892]78
[907]79install:  ${REQUIRED}
80        @#
[904]81        @# Set the correct GANGLIA_PATH.
82        @#
83        @echo
84        @echo "Using $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
85        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
86        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
87        @#
88        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
89        @#
90        @echo
91        @echo "Using $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
92        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
[924]93        @sed -i -e 's|__JOBARCHIVE_RRDS__|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
[904]94        @#
95        @# Files in SBIN_DIR
96        @#
97        @echo
98        @echo "Installing jobmond.py and jobarchived.py to $(PREFIX)/sbin"
[919]99        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin
100        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/
101        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/
102        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
[904]103        @#
[919]104        @# Files in /etc
105        @#
106        @echo
107        @echo "Installing config files jobmond.conf jobarchived.conf in /etc"
108        @install -m 0755 -d $(DESTDIR)/etc
109        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc/
110        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc/
111        @#
[911]112        @# Files specific to distros if /etc/redhat-release => rpm else (/etc/debian_version => debian)
[904]113        @#
[911]114        @if test -r /etc/redhat-release; then \
[919]115                echo; \
[953]116                echo "Red Hat detected: installing RPM service files."; \
117                if test -d /usr/lib/systemd/system; then \
118                        echo "Using systemd service files."; \
119                        install -m 0755 -d $(DESTDIR)/usr/lib/systemd/system; \
120                        install -m 0755 pkg/rpm/systemd/jobmond.service $(DESTDIR)/usr/lib/systemd/system/; \
121                        install -m 0755 pkg/rpm/systemd/jobarchived.service $(DESTDIR)/usr/lib/systemd/system/; \
122                else \
123                        echo "Using initscripts service files."; \
124                        sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/rpm/init.d/jobmond; \
125                        sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/rpm/init.d/jobarchived; \
126                        install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
127                        install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
128                        install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
129                fi; \
[904]130                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
131                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
132                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
[953]133        else \
[919]134                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' debian/jobmonarch-jobmond.init; \
135                sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' debian/jobmonarch-jobarchived.init; \
[904]136        fi
137        @#
138        @# Files in /usr/share
139        @#
140        @echo
141        @echo "Installing job_dbase.sql in $(PREFIX)/share/jobarchived"
142        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
143        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
144        @#
145        @# Create the /var/lib/jobarchive directory where rrds are stored.
146        @#
147        @echo
148        @echo "Creating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
149        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
150        @#
151        @# Files for ganglia
152        @#
153        @echo
154        @echo "Installing Ganglia web interface to $(GANGLIA_ROOT) ."
155        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
156        @chown -R $(GANGLIA_USER) ./web
157        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
158        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
159        @chmod 775 ./web/addons/job_monarch/dwoo/cache
160        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
161        @#
162        @echo
163        @echo "Installation complete."
164        @echo
[840]165
[908]166clean:
[904]167        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
168        @rm -f web/addons/job_monarch/conf.php
[916]169
170clean_all:      clean
171        @# Cannot include this in clean otherwise, dpkg-buildpackage will commit scuicide.
172        @rm -rf ${TMPDIR}/.monarch_buildroot
173
Note: See TracBrowser for help on using the repository browser.