buildsys: update make upload target
[pve-access-control.git] / Makefile
1 VERSION=4.0
2 PACKAGE=libpve-access-control
3 PKGREL=23
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 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
17 GITVERSION:=$(shell cat .git/refs/heads/master)
18
19 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
20
21 # this requires package pve-doc-generator
22 export NOVIEW=1
23 include /usr/share/pve-doc-generator/pve-doc-generator.mk
24
25 all: ${DEB}
26
27 .PHONY: dinstall
28 dinstall: deb
29         dpkg -i ${DEB}
30
31 pveum.bash-completion: PVE/CLI/pveum.pm
32         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->generate_bash_completions();" >$@.tmp
33         mv $@.tmp $@
34
35 .PHONY: install
36 install: pveum.1 oathkeygen pveum.bash-completion
37         install -d ${DESTDIR}${BINDIR}
38         install -d ${DESTDIR}${SBINDIR}
39         install -m 0755 pveum ${DESTDIR}${SBINDIR}
40         install -m 0755 oathkeygen ${DESTDIR}${BINDIR}
41         make -C PVE install
42         perl -I. ./pveum verifyapi
43         perl -I. -T -e "use PVE::CLI::pveum; PVE::CLI::pveum->verify_api();"
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: deb
51 deb: ${DEB}
52 ${DEB}:
53         rm -rf build
54         mkdir build
55         make DESTDIR=`pwd`/build install
56         install -d -m 0755 build/DEBIAN
57         sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ <control.in >build/DEBIAN/control
58         echo "git clone git://git.proxmox.com/git/pve-access-control.git\\ngit checkout ${GITVERSION}" >  build/${DOCDIR}/SOURCE
59         install -m 0644 triggers build/DEBIAN
60         install -D -m 0644 copyright build/${DOCDIR}/copyright
61         install -m 0644 changelog.Debian build/${DOCDIR}/
62         gzip -9 -n build/${DOCDIR}/changelog.Debian
63         fakeroot dpkg-deb --build build
64         mv build.deb ${DEB}
65         #rm -rf build
66         lintian ${DEB}
67
68 .PHONY: upload
69 upload: ${DEB}
70         tar cf - ${DEB} | ssh repoman@repo.proxmox.com -- upload --product pve --dist jessie --arch ${ARCH}
71
72 .PHONY: clean
73 clean:
74         make cleanup-docgen
75         rm -rf build *~ *.deb ${PACKAGE}-*.tar.gz pveum.1
76         find . -name '*~' -exec rm {} ';'
77
78 .PHONY: distclean
79 distclean: clean