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