source: branches/1.0/Makefile @ 840

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

[packaging] enhanced Makefile with install rule so it can be used for packaging.
rewrote the spec file for rpm side (removed old spec files).
tarball rules will generate the spec file and iclude it so a rpmbuild -tb can work
started to fix debian build. (still build the old way)

File size: 8.8 KB
Line 
1# Where to build
2#
3TMPDIR = /tmp
4DESTDIR = /usr/local
5
6# Clear this if you don't want to use ${FAKEROOT}
7#
8FAKEROOT = fakeroot
9
10# What is the location of the Ganglia web frontend
11# i.e.: where to we install Job Monarch's web frontend addon
12#
13WEBDIR = /var/www/ganglia
14
15VERSION = 1.0
16RELEASE = 1
17
18REQUIRED = ./jobarchived ./jobmond ./web
19
20deb:    tarball-bzip
21rpm:    tarball-bzip
22
23all:    tarball deb rpm
24
25tarball:        tarball-gzip tarball-bzip
26
27tarball-gzip:   ${REQUIRED} rpmspec
28        mkdir -p ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}
29        ( rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
30        . ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION} )
31        ( cd ${TMPDIR}/.monarch_buildroot; tar zcvf ganglia_jobmonarch-${VERSION}.tar.gz ./ganglia_jobmonarch-${VERSION} )
32        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.gz ..
33
34tarball-bzip:   ${REQUIRED} rpmspec
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 jcvf ganglia_jobmonarch-${VERSION}.tar.bz2 ./ganglia_jobmonarch-${VERSION} )
39        mv ${TMPDIR}/.monarch_buildroot/ganglia_jobmonarch-${VERSION}.tar.bz2 ..
40
41rpmspec: pkg/rpm/jobmonarch.spec.in
42        sed -e 's/__VERSION__/$(VERSION)/g' -e 's/__RELEASE__/$(RELEASE)/g' ./pkg/rpm/jobmonarch.spec.in > jobmonarch.spec
43
44debpkgdir: pkg/deb/debian
45        rsync -a --exclude=.svn pkg/deb/debian debian
46        sed -i -e 's/^Version:.*$//Version: $(VERSION)-$(RELEASE)/g' ./debian/control
47
48rpm: tarball-bzip
49        rpmbuild -tb ../ganglia_jobmonarch-${VERSION}.tar.bz2
50
51deb: debpkgdir
52        dpkg-buildpackage -b
53
54install:
55        # Files in SBIN_DIR
56        install -m 0755 -d $(DESTDIR)/usr/sbin
57        install -m 0755 jobmond/jobmond.py $(DESTDIR)/usr/sbin/
58        install -m 0755 jobarchived/jobarchived.py $(DESTDIR)/usr/sbin/
59        (cd $(DESTDIR)/usr/sbin/; ln -s jobmond.py jobmond; ln -s jobarchived.py jobarchived)
60        #
61        # Files specific to distros if /etc/sysconfig => rpm else (/etc/default => debian)
62        if test -d /etc/sysconfig; then \
63                install -m 0755 -d $(DESTDIR)/etc/rc.d/init.d; \
64                install -m 0755 pkg/rpm/init.d/jobmond $(DESTDIR)/etc/rc.d/init.d/; \
65                install -m 0755 pkg/rpm/init.d/jobarchived $(DESTDIR)/etc/rc.d/init.d/; \
66                install -m 0755 -d $(DESTDIR)/etc/sysconfig; \
67                install -m 0755 pkg/rpm/sysconfig/jobmond $(DESTDIR)/etc/sysconfig; \
68                install -m 0755 pkg/rpm/sysconfig/jobarchived $(DESTDIR)/etc/sysconfig; \
69        else \
70                install -m 0755 -d $(DESTDIR)/etc/init.d; \
71                install -m 0755 pkg/deb/init.d/jobmond $(DESTDIR)/etc/init.d/; \
72                install -m 0755 pkg/deb/init.d/jobarchived $(DESTDIR)/etc/init.d/; \
73                install -m 0755 -d $(DESTDIR)/etc/default; \
74                install -m 0755 pkg/deb/default/jobmond $(DESTDIR)/etc/default; \
75                install -m 0755 pkg/deb/default/jobarchived $(DESTDIR)/etc/default; \
76        fi
77        #
78        # Files in /etc
79        #
80        install -m 0644 jobmond/jobmond.conf $(DESTDIR)/etc; \
81        install -m 0644 jobarchived/jobarchived.conf $(DESTDIR)/etc; \
82        #
83        # Files in /usr/share
84        #
85        install -m 0755 -d $(DESTDIR)/usr/share/jobarchived/
86        install -m 0755 jobarchived/job_dbase.sql $(DESTDIR)/usr/share/jobarchived/
87        #
88        # Create the /var/lib/jobarchive directory where rrds are stored.
89        #
90        install -m 0755 -d $(DESTDIR)/var/lib/jobarchive/
91        #
92        # Files for ganglia (adapt to rpm or deb or unknown ganglia packaging)
93        #
94        if test -d /etc/sysconfig; then \
95                install -m 0755 -d $(DESTDIR)/usr/share/ganglia; \
96                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia); \
97        elif test -d /etc/default; then \
98                install -m 0755 -d $(DESTDIR)/usr/share/ganglia-webfrontend; \
99                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/usr/share/ganglia-webfrontend); \
100        else \
101                install -m 0755 -d $(DESTDIR)/$(WEBDIR); \
102                (cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php . $(DESTDIR)/$(WEBDIR)); \
103        fi
104
105
106deb-webfrontend:        ${REQUIRED}
107        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN >/dev/null
108        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${WEBDIR} >/dev/null
109        ( cd web; rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
110        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/${WEBDIR} )
111        ( cd pkg/deb/web/DEBIAN; \
112        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
113        . ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN )
114        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control \
115        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new; \
116        mv jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control.new \
117        jobmonarch-webfrontend_${VERSION}-${RELEASE}/DEBIAN/control )
118        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-webfrontend_${VERSION}-${RELEASE} )
119        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-webfrontend_${VERSION}-${RELEASE}.deb ..
120
121deb-jobarchived:        ${REQUIRED}
122        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN >/dev/null
123        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d >/dev/null
124        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default >/dev/null
125        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin >/dev/null
126        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived >/dev/null
127        install -m 755 jobarchived/jobarchived.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin
128        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/sbin; \
129        ln -s jobarchived.py jobarchived || true)
130        install jobarchived/jobarchived.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc
131        install pkg/deb/init.d/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/init.d
132        install pkg/deb/default/jobarchived ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/etc/default
133        install jobarchived/job_dbase.sql \
134        ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/usr/share/jobarchived
135        ( cd pkg/deb/jobarchived/DEBIAN; \
136        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
137        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN )
138        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control \
139        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new; \
140        mv jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control.new \
141        jobmonarch-jobarchived_${VERSION}-${RELEASE}/DEBIAN/control )
142        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobarchived_${VERSION}-${RELEASE} )
143        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobarchived_${VERSION}-${RELEASE}.deb ..
144
145deb-jobmond:    ${REQUIRED}
146        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN >/dev/null
147        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d >/dev/null
148        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default >/dev/null
149        mkdir -p ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin >/dev/null
150        install -m 755 jobmond/jobmond.py ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin
151        ( cd ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/usr/sbin; \
152        ln -s jobmond.py jobmond || true)
153        install jobmond/jobmond.conf ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc
154        install pkg/deb/init.d/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/init.d
155        install pkg/deb/default/jobmond ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/etc/default
156        ( cd pkg/deb/jobmond/DEBIAN; \
157        rsync -a --exclude=.svn --exclude=*_test* --exclude=*-example.php \
158        . ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN )
159        ( cd ${TMPDIR}/.monarch_buildroot/; cat jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control \
160        | sed "s/^Version:.*$//Version: ${VERSION}-${RELEASE}/g" >jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new; \
161        mv jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control.new jobmonarch-jobmond_${VERSION}-${RELEASE}/DEBIAN/control )
162        ( cd ${TMPDIR}/.monarch_buildroot/; ${FAKEROOT} dpkg -b jobmonarch-jobmond_${VERSION}-${RELEASE} )
163        mv ${TMPDIR}/.monarch_buildroot/jobmonarch-jobmond_${VERSION}-${RELEASE}.deb ..
164
165clean:
166        rm -rf ${TMPDIR}/.monarch_buildroot
167        rm -rf ./jobmonarch.spec
168        rm -rf ./debian
Note: See TracBrowser for help on using the repository browser.