convert pveum into a PVE::CLI class
[pve-access-control.git] / Makefile
1 RELEASE=4.0
2
3 VERSION=4.0
4 PACKAGE=libpve-access-control
5 PKGREL=8
6
7 DESTDIR=
8 PREFIX=/usr
9 BINDIR=${PREFIX}/bin
10 SBINDIR=${PREFIX}/sbin
11 MANDIR=${PREFIX}/share/man
12 DOCDIR=${PREFIX}/share/doc/${PACKAGE}
13 PODDIR=${DOCDIR}/pod
14 MAN1DIR=${MANDIR}/man1/
15 export PERLDIR=${PREFIX}/share/perl5
16
17 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
18 GITVERSION:=$(shell cat .git/refs/heads/master)
19
20 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
21
22 all: ${DEB}
23
24 .PHONY: dinstall
25 dinstall: deb
26         dpkg -i ${DEB}
27
28 %.1.gz: %.1.pod
29         rm -f $@
30         cat $<|pod2man -n $* -s 1 -r ${VERSION} -c "Proxmox Documentation"|gzip -c9 >$@.tmp
31         mv $@.tmp $@
32
33 pveum.1.pod: PVE/CLI/pveum.pm
34         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_pod_manpage();" >$@.tmp
35         mv $@.tmp $@
36
37 .PHONY: install
38 install: pveum.1.pod pveum.1.gz oathkeygen
39         install -d ${DESTDIR}${BINDIR}
40         install -d ${DESTDIR}${SBINDIR}
41         install -m 0755 pveum ${DESTDIR}${SBINDIR}
42         install -m 0755 oathkeygen ${DESTDIR}${BINDIR}
43         make -C PVE install
44         perl -I. ./pveum verifyapi
45         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->verify_api();"
46         install -d ${DESTDIR}/usr/share/man/man1
47         install -d ${DESTDIR}${PODDIR}
48         install -m 0644 pveum.1.gz ${DESTDIR}/usr/share/man/man1/
49         install -m 0644 pveum.1.pod ${DESTDIR}/${PODDIR}
50
51 .PHONY: deb ${DEB}
52 deb ${DEB}:
53         rm -rf build
54         mkdir build
55         make DESTDIR=`pwd`/build install
56         install -d -m 0755 build/DEBIAN
57         sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ <control.in >build/DEBIAN/control
58         echo "git clone git://git.proxmox.com/git/pve-access-control.git\\ngit checkout ${GITVERSION}" >  build/${DOCDIR}/SOURCE
59         install -m 0644 triggers build/DEBIAN
60         install -D -m 0644 copyright build/${DOCDIR}/copyright
61         install -m 0644 changelog.Debian build/${DOCDIR}/
62         gzip -9 build/${DOCDIR}/changelog.Debian
63         dpkg-deb --build build  
64         mv build.deb ${DEB}
65         #rm -rf build
66         lintian ${DEB}
67
68 .PHONY: upload
69 upload: ${DEB}
70         umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw 
71         mkdir -p /pve/${RELEASE}/extra
72         rm -f /pve/${RELEASE}/extra/${PACKAGE}_*.deb
73         rm -f /pve/${RELEASE}/extra/Packages*
74         cp ${DEB} /pve/${RELEASE}/extra
75         cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
76         umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
77
78 .PHONY: clean
79 clean:  
80         rm -rf build *~ *.deb ${PACKAGE}-*.tar.gz pveum.1.pod pveum.1.gz
81         find . -name '*~' -exec rm {} ';'
82
83 .PHONY: distclean
84 distclean: clean