]> git.proxmox.com Git - proxmox-perl-rs.git/blame - pve-rs/Makefile
major build system upgrade
[proxmox-perl-rs.git] / pve-rs / Makefile
CommitLineData
1ae868ad
WB
1include /usr/share/dpkg/default.mk
2
3PACKAGE=libpve-rs-perl
4export PERLMOD_PRODUCT=PVE
5
6ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
7export GITVERSION:=$(shell git rev-parse HEAD)
8
9PERL_INSTALLVENDORARCH != perl -MConfig -e 'print $$Config{installvendorarch};'
10PERL_INSTALLVENDORLIB != perl -MConfig -e 'print $$Config{installvendorlib};'
11
12MAIN_DEB=${PACKAGE}_${DEB_VERSION}_${ARCH}.deb
13DBGSYM_DEB=${PACKAGE}-dbgsym_${DEB_VERSION}_${ARCH}.deb
14DEBS=$(MAIN_DEB) $(DBGSYM_DEB)
15
16DESTDIR=
17
d00bfdcd 18PM_DIR := PVE
1ae868ad 19
932d602d
WB
20PERLMOD_GENPACKAGE := /usr/lib/perlmod/genpackage.pl \
21 --lib=pve_rs \
22 --lib-tag=proxmox \
23 --lib-package=Proxmox::Lib::PVE \
24 --lib-prefix=PVE
25
26PERLMOD_PACKAGES := \
27 PVE::RS::APT::Repositories \
28 PVE::RS::OpenId \
29 PVE::RS::ResourceScheduling::Static \
30 PVE::RS::TFA
31
1ae868ad
WB
32ifeq ($(BUILD_MODE), release)
33CARGO_BUILD_ARGS += --release
13e3d8b8
WB
34TARGET_DIR=release
35else
36TARGET_DIR=debug
1ae868ad
WB
37endif
38
932d602d 39all: PVE
1ae868ad
WB
40ifneq ($(BUILD_MODE), skip)
41 cargo build $(CARGO_BUILD_ARGS)
13e3d8b8
WB
42 mkdir -p test/Proxmox/Lib
43 sed -r -e \
44 's@^sub libdirs.*$$@sub libdirs { return ("../target/$(TARGET_DIR)", "../../target/$(TARGET_DIR)"); }@' \
45 Proxmox/Lib/PVE.pm >test/Proxmox/Lib/PVE.pm
1ae868ad
WB
46endif
47
932d602d
WB
48PVE: Proxmox/Lib/PVE.pm
49Proxmox/Lib/PVE.pm:
50 $(PERLMOD_GENPACKAGE) $(PERLMOD_PACKAGES)
6b2814d6 51
13e3d8b8
WB
52check: all
53 $(MAKE) -C test test
54
1ae868ad 55.PHONY: install
06488769 56install: ../target/release/libpve_rs.so Proxmox/Lib/PVE.pm PVE
1ae868ad 57 install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto
06488769 58 install -m644 ../target/release/libpve_rs.so $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto/libpve_rs.so
d00bfdcd
WB
59 install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)
60 install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib
61 install -m644 Proxmox/Lib/PVE.pm $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib/PVE.pm
62 find $(PM_DIR) \! -type d -print -exec install -Dm644 '{}' $(DESTDIR)$(PERL_INSTALLVENDORLIB)'/{}' ';'
1ae868ad 63
1ae868ad
WB
64distclean: clean
65
66clean:
67 cargo clean
856ab916 68 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes Cargo.lock
1ae868ad
WB
69 find . -name '*~' -exec rm {} ';'
70
71.PHONY: dinstall
72dinstall: ${DEBS}
73 dpkg -i ${DEBS}
74
75.PHONY: upload
76upload: ${DEBS}
77 # check if working directory is clean
78 git diff --exit-code --stat && git diff --exit-code --stat --staged
79 tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pve --dist bullseye