source: branches/1.0/Makefile @ 859

Last change on this file since 859 was 859, checked in by olahaye, 10 years ago

[Makefile] Add missing Makefile dependancy on .spec file (updating the RELEASE must trigger spec file generation)

File size: 5.3 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.0
26RELEASE = 1
27
28REQUIRED = ./jobarchived ./jobmond ./web
29
30all:
31
32tarball:        tarball-gzip tarball-bzip
33
34tarball-gzip:   ${REQUIRED} ./pkg/rpm/jobmonarch.spec
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
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
59deb: ${REQUIRED} ./debian
60        # FIXME set $(VERSION)-$(RELEASE) in ./debian/changelog
61        dpkg-buildpackage -b -uc -us
62
63install:
64        @#
65        @# Set the correct GANGLIA_PATH.
66        @#
67        @echo "\nUsing $(GANGLIA_ROOT) as Ganglia root installation path. If it's not what"
68        @echo "you want, use make GANGLIA_ROOT=/path/to/your/ganglia/root ."
69        @sed -e 's|__GANGLIA_ROOT__|$(GANGLIA_ROOT)/|g' web/conf.php.in > web/addons/job_monarch/conf.php
70        @#
71        @# Set the correct JOBARCHIVE_RRDS in jobarchve.conf and ganglia conf.php
72        @#
73        @echo "\nUsing $(JOBARCHIVE_RRDS) as jobarchive path to  store rrds files. If it's not what"
74        @echo "you want, use make JOBARCHIVE_RRDS=/path/to/you/jobarchived/rrdsfiles ."
75        @sed -i -e 's|/var/lib/jobarchive|$(JOBARCHIVE_RRDS)|g' jobarchived/jobarchived.conf web/addons/job_monarch/conf.php
76        @#
77        @# Files in SBIN_DIR
78        @#
79        @echo "\nInstalling jobmond.py and jobarchived.py to $(PREFIX)/sbin"
80        @install -m 0755 -d $(DESTDIR)$(PREFIX)/sbin
81        @install -m 0755 jobmond/jobmond.py $(DESTDIR)$(PREFIX)/sbin/
82        @install -m 0755 jobarchived/jobarchived.py $(DESTDIR)$(PREFIX)/sbin/
83        @(cd $(DESTDIR)$(PREFIX)/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
84        @#
85        @# Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
86        @#
87        @echo "\nInstalling service files in $(DESTDIR)/etc"
88        @if test -d /etc/sysconfig; then \
89                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
90                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
91                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
92                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
93                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
94                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
95        else \
96                install -m 0755 -d $(DESTDIR)/etc/init.d; \
97                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
98                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
99                install -m 0755 -d $(DESTDIR)/etc/default; \
100                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
101                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
102        fi
103        @#
104        @# Files in /etc
105        @#
106        @echo "\nInstalling config files jobmond.conf jobarchived.conf in $(DESTDIR)/etc"
107        @install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc
108        @install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc
109        @#
110        @# Files in /usr/share
111        @#
112        @echo "\nInstalling job_dbase.sql in $(PREFIX)/share/jobarchived"
113        @install -m 0755 -d $(DESTDIR)$(PREFIX)/share/jobarchived
114        @install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)$(PREFIX)/share/jobarchived/
115        @#
116        @# Create the /var/lib/jobarchive directory where rrds are stored.
117        @#
118        @echo "\nCreating the directory where RRDs will be stored: $(JOBARCHIVE_RRDS)"
119        @install -m 0755 -d $(DESTDIR)$(JOBARCHIVE_RRDS)
120        @#
121        @# Files for ganglia
122        @#
123        @echo "\nInstalling Ganglia web interface to $(GANGLIA_ROOT) ."
124        @install -m 0755 -d $(DESTDIR)$(GANGLIA_ROOT)
125        @chown -R $(GANGLIA_USER) ./web
126        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/compiled
127        @chown $(HTTPD_USER) ./web/addons/job_monarch/dwoo/cache
128        @chmod 775 ./web/addons/job_monarch/dwoo/cache
129        @(cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php ./addons ./templates $(DESTDIR)$(GANGLIA_ROOT)/)
130        @#
131        @echo "\nInstallation complete.\n"
132
133clean:
134        @rm -rf ${TMPDIR}/.monarch_buildroot
135        @rm -rf ./pkg/rpm/jobmonarch.spec
136        @(cd ./debian; rm -rf files *.log *.substvars jobmonarch/ jobmonarch-jobmond/ jobmonarch-jobarchived/ jobmonarch-webfrontend/ tmp/)
137        @rm -f web/addons/job_monarch/conf.php
Note: See TracBrowser for help on using the repository browser.