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