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