source: branches/1.0/Makefile @ 900

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

Makefile:

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