]> git.proxmox.com Git - pve-client.git/blobdiff - Makefile
Makefile: cleanup - use a loop to install files
[pve-client.git] / Makefile
index 7daa42836582716cd0abf6d03b6342ef7ca921b8..0e11af52d418a0ddc7ac9a39d6dfc7cdb815ae8d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,29 @@ DEB=${PACKAGE}_${PKGVER}-${PKGREL}_all.deb
 
 DESTDIR=
 
+PERL5_DIR=${DESTDIR}/usr/share/perl5
 LIB_DIR=${DESTDIR}/usr/share/${PACKAGE}
 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
 BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
 
+PVE_COMMON_FILES=              \
+       CLIHandler.pm           \
+       JSONSchema.pm           \
+       PTY.pm                  \
+       RESTHandler.pm          \
+       SafeSyslog.pm           \
+       SectionConfig.pm        \
+
+PVE_CLIENT_SOURCES=                            \
+       PVE/APIClient/Tools.pm                  \
+       PVE/APIClient/Helpers.pm                \
+       PVE/APIClient/Config.pm                 \
+       PVE/APIClient/Commands/remote.pm        \
+       PVE/APIClient/Commands/config.pm        \
+       PVE/APIClient/Commands/lxc.pm           \
+       PVE/APIClient/Commands/list.pm          \
+       PVE/APIClient/Commands/GuestStatus.pm
+
 all: ${DEB}
 
 .PHONY: deb
@@ -21,27 +40,23 @@ deb ${DEB}:
        lintian ${DEB}
 
 install:  pve-api-definition.dat
-       install -d -m 0755 ${LIB_DIR}/PVE
+       install -d -m 0755 ${PERL5_DIR}/PVE/APIClient
        # install library tools from pve-common
-       install -m 0644 PVE/Tools.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/SafeSyslog.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/Exception.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/JSONSchema.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/RESTHandler.pm  ${LIB_DIR}/PVE
-       install -m 0644 PVE/CLIHandler.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/PTY.pm ${LIB_DIR}/PVE
-       install -m 0644 PVE/SectionConfig.pm ${LIB_DIR}/PVE
+       for i in ${PVE_COMMON_FILES}; do install -m 0644 PVE/APIClient/$$i ${PERL5_DIR}/PVE/APIClient; done
        # install pveclient
-       install -D -m 0644 PVE/APIClient/Helpers.pm ${LIB_DIR}/PVE/APIClient/Helpers.pm
-       install -D -m 0644 PVE/APIClient/Config.pm ${LIB_DIR}/PVE/APIClient/Config.pm
-       install -D -m 0644 PVE/APIClient/Commands/remote.pm ${LIB_DIR}/PVE/APIClient/Commands/remote.pm
-       install -D -m 0644 PVE/APIClient/Commands/lxc.pm ${LIB_DIR}/PVE/APIClient/Commands/lxc.pm
-       install -D -m 0644 PVE/APIClient/Commands/GuestStatus.pm ${LIB_DIR}/PVE/APIClient/Commands/GuestStatus.pm
+       for i in ${PVE_CLIENT_SOURCES}; do install -D -m 0644 $$i ${PERL5_DIR}/$$i; done
        install -D -m 0644 pve-api-definition.dat ${LIB_DIR}/pve-api-definition.dat
        install -D -m 0755 pveclient ${DESTDIR}/usr/bin/pveclient
        install -D -m 0644 pveclient.bash-completion ${BASHCOMPLDIR}/pveclient
 
 
+update-pve-common:
+       for i in ${PVE_COMMON_FILES}; do cp ../pve-common/src/PVE/$$i PVE/APIClient/; done
+       for i in ${PVE_COMMON_FILES}; do sed -i 's/PVE::/PVE::APIClient::/g' PVE/APIClient/$$i; done
+       # Remove INotify from CLIHandler.pm
+       sed -i 's/use PVE::APIClient::INotify;//' PVE/APIClient/CLIHandler.pm
+
+
 pve-api-definition.dat:
        ./extractapi.pl > pve-api-definition.dat.tmp
        mv pve-api-definition.dat.tmp pve-api-definition.dat