API/ticket: rework coarse grained permission computation
[pve-access-control.git] / Makefile
1 VERSION=5.0
2 PACKAGE=libpve-access-control
3 PKGREL=6
4
5 DESTDIR=
6 PREFIX=/usr
7 BINDIR=${PREFIX}/bin
8 SBINDIR=${PREFIX}/sbin
9 MANDIR=${PREFIX}/share/man
10 DOCDIR=${PREFIX}/share/doc/${PACKAGE}
11 MAN1DIR=${MANDIR}/man1/
12 BASHCOMPLDIR=${PREFIX}/share/bash-completion/completions/
13
14 export PERLDIR=${PREFIX}/share/perl5
15
16 export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
17
18 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
19 GITVERSION:=$(shell cat .git/refs/heads/master)
20
21 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
22
23 # this requires package pve-doc-generator
24 export NOVIEW=1
25 include /usr/share/pve-doc-generator/pve-doc-generator.mk
26
27 all:
28
29 .PHONY: dinstall
30 dinstall: deb
31         dpkg -i ${DEB}
32
33 pveum.bash-completion: PVE/CLI/pveum.pm
34         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_bash_completions();" >$@.tmp
35         mv $@.tmp $@
36
37 .PHONY: install
38 install: pveum.1 oathkeygen pveum.bash-completion
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         install -d ${DESTDIR}/${MAN1DIR}
45         install -d ${DESTDIR}/${DOCDIR}
46         install -m 0644 pveum.1 ${DESTDIR}/${MAN1DIR}
47         gzip -9 -n ${DESTDIR}/${MAN1DIR}/pveum.1
48         install -m 0644 -D pveum.bash-completion ${DESTDIR}${BASHCOMPLDIR}/pveum
49
50 .PHONY: test
51 test:
52         perl -I. ./pveum verifyapi
53         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->verify_api();"
54
55 .PHONY: deb
56 deb: ${DEB}
57 ${DEB}:
58         rm -rf build
59         rsync -a * build
60         echo "git clone git://git.proxmox.com/git/pve-access-control.git\\ngit checkout ${GITVERSION}" >build/debian/SOURCE
61         cd build; dpkg-buildpackage -b -us -uc
62         lintian ${DEB}
63
64 .PHONY: upload
65 upload: ${DEB}
66         tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist stretch --arch ${ARCH}
67
68 .PHONY: clean
69 clean:
70         make cleanup-docgen
71         rm -rf build *.deb *.buildinfo *.changes
72         find . -name '*~' -exec rm {} ';'
73
74 .PHONY: distclean
75 distclean: clean