bump version to 5.1-7
[pve-access-control.git] / Makefile
1 VERSION=5.1
2 PACKAGE=libpve-access-control
3 PKGREL=7
4
5 BUILDDIR ?= ${PACKAGE}-${VERSION}
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 MAN1DIR=${MANDIR}/man1/
14 BASHCOMPLDIR=${PREFIX}/share/bash-completion/completions/
15 ZSHCOMPLDIR=${PREFIX}/share/zsh/vendor-completions/
16
17 export PERLDIR=${PREFIX}/share/perl5
18
19 export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
20
21 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
22 GITVERSION:=$(shell cat .git/refs/heads/master)
23
24 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
25 DSC=${PACKAGE}_${VERSION}-${PKGREL}.dsc
26
27 # this requires package pve-doc-generator
28 export NOVIEW=1
29 include /usr/share/pve-doc-generator/pve-doc-generator.mk
30
31 all:
32
33 .PHONY: dinstall
34 dinstall: deb
35         dpkg -i ${DEB}
36
37 pveum.bash-completion: PVE/CLI/pveum.pm
38         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_bash_completions();" >$@.tmp
39         mv $@.tmp $@
40
41 pveum.zsh-completion: PVE/CLI/pveum.pm
42         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_zsh_completions();" >$@.tmp
43         mv $@.tmp $@
44
45 .PHONY: install
46 install: pveum.1 oathkeygen pveum.bash-completion pveum.zsh-completion
47         install -d ${DESTDIR}${BINDIR}
48         install -d ${DESTDIR}${SBINDIR}
49         install -m 0755 pveum ${DESTDIR}${SBINDIR}
50         install -m 0755 oathkeygen ${DESTDIR}${BINDIR}
51         make -C PVE install
52         install -d ${DESTDIR}/${MAN1DIR}
53         install -d ${DESTDIR}/${DOCDIR}
54         install -m 0644 pveum.1 ${DESTDIR}/${MAN1DIR}
55         gzip -9 -n ${DESTDIR}/${MAN1DIR}/pveum.1
56         install -m 0644 -D pveum.bash-completion ${DESTDIR}${BASHCOMPLDIR}/pveum
57         install -m 0644 -D pveum.zsh-completion ${DESTDIR}${ZSHCOMPLDIR}/_pveum
58
59 .PHONY: test
60 test:
61         perl -I. ./pveum verifyapi
62         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->verify_api();"
63
64 ${BUILDDIR}:
65         rm -rf ${BUILDDIR}
66         rsync -a * ${BUILDDIR}
67         echo "git clone git://git.proxmox.com/git/pve-access-control.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}/debian/SOURCE
68
69 .PHONY: deb
70 deb: ${DEB}
71 ${DEB}: ${BUILDDIR}
72         cd ${BUILDDIR}; dpkg-buildpackage -b -us -uc
73         lintian ${DEB}
74
75 .PHONY: dsc
76 dsc: ${DSC}
77 ${DSC}: ${BUILDDIR}
78         cd ${BUILDDIR}; dpkg-buildpackage -S -us -uc -d
79         lintian ${DSC}
80
81 .PHONY: upload
82 upload: ${DEB}
83         tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist stretch --arch ${ARCH}
84
85 .PHONY: clean
86 clean:
87         rm -rf ${BUILDDIR}
88         make cleanup-docgen
89         rm -rf *.deb *.buildinfo *.changes ${PACKAGE}*.tar.gz *.dsc
90         find . -name '*~' -exec rm {} ';'
91
92 .PHONY: distclean
93 distclean: clean