]> git.proxmox.com Git - pve-client.git/blob - Makefile
pve-api-definition.dat: add root index method
[pve-client.git] / Makefile
1 PACKAGE=pve-client
2 PKGVER=0.1
3 PKGREL=1
4
5 DEB=${PACKAGE}_${PKGVER}-${PKGREL}_all.deb
6
7 DESTDIR=
8
9 PERL5_DIR=${DESTDIR}/usr/share/perl5
10 LIB_DIR=${DESTDIR}/usr/share/${PACKAGE}
11 MAN1DIR=${DESTDIR}//usr/share/man/man1
12 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
13 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
14
15 PVE_COMMON_FILES= \
16 Tools.pm \
17 Syscall.pm \
18 CLIHandler.pm \
19 JSONSchema.pm \
20 PTY.pm \
21 RESTHandler.pm \
22 SafeSyslog.pm \
23 SectionConfig.pm \
24
25 PVE_CLIENT_SOURCES= \
26 PVE/APIClient/Helpers.pm \
27 PVE/APIClient/Config.pm \
28 PVE/APIClient/Commands/remote.pm \
29 PVE/APIClient/Commands/config.pm \
30 PVE/APIClient/Commands/lxc.pm \
31 PVE/APIClient/Commands/list.pm \
32 PVE/APIClient/Commands/GuestStatus.pm
33
34 all: ${DEB}
35
36 .PHONY: deb
37 deb ${DEB}:
38 rm -rf build
39 rsync -a debian build
40 make DESTDIR=./build install
41 cd build; dpkg-buildpackage -rfakeroot -b -us -uc
42 lintian ${DEB}
43
44 pveclient.1-synopsis.adoc: pveclient ${PVE_CLIENT_SOURCES}
45 perl -I. ./pveclient printsynopsis > $@.tmp
46 mv $@.tmp $@
47
48 pveclient.1: pveclient.1-synopsis.adoc
49 a2x -f manpage pveclient.adoc
50
51 install: pve-api-definition.dat pveclient.1
52 install -d -m 0755 ${PERL5_DIR}/PVE/APIClient
53 # install library tools from pve-common
54 for i in ${PVE_COMMON_FILES}; do install -m 0644 PVE/APIClient/$$i ${PERL5_DIR}/PVE/APIClient; done
55 # install pveclient
56 for i in ${PVE_CLIENT_SOURCES}; do install -D -m 0644 $$i ${PERL5_DIR}/$$i; done
57 install -D -m 0644 pve-api-definition.dat ${LIB_DIR}/pve-api-definition.dat
58 install -D -m 0755 pveclient ${DESTDIR}/usr/bin/pveclient
59 install -D -m 0644 pveclient.bash-completion ${BASHCOMPLDIR}/pveclient
60 # install manual page
61 install -D -m 0644 pveclient.1 ${MAN1DIR}/pveclient.1
62 gzip -9 ${MAN1DIR}/pveclient.1
63
64 update-pve-common:
65 for i in ${PVE_COMMON_FILES}; do cp ../pve-common/src/PVE/$$i PVE/APIClient/; done
66 for i in ${PVE_COMMON_FILES}; do sed -i 's/PVE::/PVE::APIClient::/g' PVE/APIClient/$$i; done
67 # Remove INotify from CLIHandler.pm
68 sed -i 's/use PVE::APIClient::INotify;//' PVE/APIClient/CLIHandler.pm
69
70
71 pve-api-definition.dat:
72 ./extractapi.pl > pve-api-definition.dat.tmp
73 mv pve-api-definition.dat.tmp pve-api-definition.dat
74
75 #.PHONY: upload
76 #upload: ${DEB}
77 # tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com upload --product pmg,pve --dist stretch
78
79 distclean: clean
80
81 clean:
82 rm -rf ./build *.deb *.changes *.buildinfo
83 rm pveclient.1-synopsis.adoc pveclient.1
84 find . -name '*~' -exec rm {} ';'
85
86 .PHONY: dinstall
87 dinstall: ${DEB}
88 dpkg -i ${DEB}