change configuration file name ~/.config/pveclient/config
[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 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
12 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
13
14 PVE_COMMON_FILES=               \
15         CLIHandler.pm           \
16         JSONSchema.pm           \
17         PTY.pm                  \
18         RESTHandler.pm          \
19         SafeSyslog.pm           \
20         SectionConfig.pm        \
21
22 PVE_CLIENT_SOURCES=                             \
23         PVE/APIClient/Tools.pm                  \
24         PVE/APIClient/Helpers.pm                \
25         PVE/APIClient/Config.pm                 \
26         PVE/APIClient/Commands/remote.pm        \
27         PVE/APIClient/Commands/config.pm        \
28         PVE/APIClient/Commands/lxc.pm           \
29         PVE/APIClient/Commands/list.pm          \
30         PVE/APIClient/Commands/GuestStatus.pm
31
32 all: ${DEB}
33
34 .PHONY: deb
35 deb ${DEB}:
36         rm -rf build
37         rsync -a debian build
38         make DESTDIR=./build install
39         cd build; dpkg-buildpackage -rfakeroot -b -us -uc
40         lintian ${DEB}
41
42 install:  pve-api-definition.dat
43         install -d -m 0755 ${PERL5_DIR}/PVE/APIClient
44         # install library tools from pve-common
45         for i in ${PVE_COMMON_FILES}; do install -m 0644 PVE/APIClient/$$i ${PERL5_DIR}/PVE/APIClient; done
46         # install pveclient
47         for i in ${PVE_CLIENT_SOURCES}; do install -D -m 0644 $$i ${PERL5_DIR}/$$i; done
48         install -D -m 0644 pve-api-definition.dat ${LIB_DIR}/pve-api-definition.dat
49         install -D -m 0755 pveclient ${DESTDIR}/usr/bin/pveclient
50         install -D -m 0644 pveclient.bash-completion ${BASHCOMPLDIR}/pveclient
51
52
53 update-pve-common:
54         for i in ${PVE_COMMON_FILES}; do cp ../pve-common/src/PVE/$$i PVE/APIClient/; done
55         for i in ${PVE_COMMON_FILES}; do sed -i 's/PVE::/PVE::APIClient::/g' PVE/APIClient/$$i; done
56         # Remove INotify from CLIHandler.pm
57         sed -i 's/use PVE::APIClient::INotify;//' PVE/APIClient/CLIHandler.pm
58
59
60 pve-api-definition.dat:
61         ./extractapi.pl > pve-api-definition.dat.tmp
62         mv pve-api-definition.dat.tmp pve-api-definition.dat
63
64 #.PHONY: upload
65 #upload: ${DEB}
66 #       tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com upload --product pmg,pve --dist stretch
67
68 distclean: clean
69
70 clean:
71         rm -rf ./build *.deb *.changes *.buildinfo
72         find . -name '*~' -exec rm {} ';'
73
74 .PHONY: dinstall
75 dinstall: ${DEB}
76         dpkg -i ${DEB}