source: branches/1.0/Makefile @ 908

Last change on this file since 908 was 908, checked in by olahaye, 8 years ago

[Makefile] 1st line of rule accidentaly moved as a dependancy: restored correct syntax.

File size: 6.0 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:
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
57rpm: tarball-bzip
58        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
59
60srpm: tarball-bzip
61        rpmbuild -ts --define '%dist %{nil}' ../ganglia_jobmonarch-${VERSION}.tar.bz2
62
63debchangelog: ./debian/changelog
64
65./debian/changelog: ./debian/changelog.in Makefile
66        sed -e 's/__VERSION__/${VERSION}/g' -e 's/__RELEASE__/${RELEASE}/g' ./debian/changelog.in > ./debian/changelog
67
68deb: ${REQUIRED} ./debian ./debian/changelog
69        dpkg-buildpackage -b -uc -us
70
71install:  ${REQUIRED}
72        @#
73        @# Set the correct GANGLIA_PATH.
74        @#
75        @echo
76        @echo "Using $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
77        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
78        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
79        @#
80        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
81        @#
82        @echo
83        @echo "Using $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
84        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
85        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
86        @#
87        @# Files in SBIN_DIR
88        @#
89        @echo
90        @echo "Installing jobmond.py and jobarchived.py to $(PREFIX)/sbin"
91        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin || true
92        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/ || true
93        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/ || true
94        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived) || true
95        @#
96        @# Files specific to distros if /etc/redhat_release => rpm else (/etc/debian_version => debian)
97        @#
98        @echo
99        @echo "Installing service files in /etc"
100        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/deb/init.d/jobmond
101        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/deb/init.d/jobarchived
102        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBMOND)|g' pkg/rpm/init.d/jobmond
103        @sed -i -e 's|DAEMON=.*|DAEMON=$(JOBARCHIVED)|g' pkg/rpm/init.d/jobarchived
104        @if test -r /etc/redhat_release; then \
105                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
106                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
107                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
108                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
109                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
110                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
111        else \
112                install -m 0755 -d $(DESTDIR)/etc/init.d; \
113                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
114                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
115                install -m 0755 -d $(DESTDIR)/etc/default; \
116                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
117                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
118        fi
119        @#
120        @# Files in /etc
121        @#
122        @echo
123        @echo "Installing config files jobmond.conf jobarchived.conf in /etc"
124        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
125        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
126        @#
127        @# Files in /usr/share
128        @#
129        @echo
130        @echo "Installing job_dbase.sql in $(PREFIX)/share/jobarchived"
131        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
132        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
133        @#
134        @# Create the /var/lib/jobarchive directory where rrds are stored.
135        @#
136        @echo
137        @echo "Creating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
138        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
139        @#
140        @# Files for ganglia
141        @#
142        @echo
143        @echo "Installing Ganglia web interface to $(GANGLIA_ROOT) ."
144        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
145        @chown -R $(GANGLIA_USER) ./web
146        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
147        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
148        @chmod 775 ./web/addons/job_monarch/dwoo/cache
149        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
150        @#
151        @echo
152        @echo "Installation complete."
153        @echo
154
155clean:
156        @rm -rf ${TMPDIR}/.monarch_buildroot
157        @rm -rf ./pkg/rpm/jobmonarch.spec
158        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
159        @rm -f web/addons/job_monarch/conf.php
Note: See TracBrowser for help on using the repository browser.