]>
Commit | Line | Data |
---|---|---|
1ae868ad WB |
1 | include /usr/share/dpkg/default.mk |
2 | ||
3 | PACKAGE=libpve-rs-perl | |
4 | export PERLMOD_PRODUCT=PVE | |
5 | ||
6 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) | |
7 | export GITVERSION:=$(shell git rev-parse HEAD) | |
8 | ||
9 | PERL_INSTALLVENDORARCH != perl -MConfig -e 'print $$Config{installvendorarch};' | |
10 | PERL_INSTALLVENDORLIB != perl -MConfig -e 'print $$Config{installvendorlib};' | |
11 | ||
12 | MAIN_DEB=${PACKAGE}_${DEB_VERSION}_${ARCH}.deb | |
13 | DBGSYM_DEB=${PACKAGE}-dbgsym_${DEB_VERSION}_${ARCH}.deb | |
14 | DEBS=$(MAIN_DEB) $(DBGSYM_DEB) | |
15 | ||
16 | DESTDIR= | |
17 | ||
d00bfdcd | 18 | PM_DIR := PVE |
1ae868ad | 19 | |
932d602d WB |
20 | PERLMOD_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 | ||
26 | PERLMOD_PACKAGES := \ | |
27 | PVE::RS::APT::Repositories \ | |
28 | PVE::RS::OpenId \ | |
29 | PVE::RS::ResourceScheduling::Static \ | |
30 | PVE::RS::TFA | |
31 | ||
1ae868ad WB |
32 | ifeq ($(BUILD_MODE), release) |
33 | CARGO_BUILD_ARGS += --release | |
13e3d8b8 WB |
34 | TARGET_DIR=release |
35 | else | |
36 | TARGET_DIR=debug | |
1ae868ad WB |
37 | endif |
38 | ||
932d602d | 39 | all: PVE |
1ae868ad WB |
40 | ifneq ($(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 |
46 | endif |
47 | ||
932d602d WB |
48 | PVE: Proxmox/Lib/PVE.pm |
49 | Proxmox/Lib/PVE.pm: | |
50 | $(PERLMOD_GENPACKAGE) $(PERLMOD_PACKAGES) | |
6b2814d6 | 51 | |
13e3d8b8 WB |
52 | check: all |
53 | $(MAKE) -C test test | |
54 | ||
1ae868ad | 55 | .PHONY: install |
06488769 | 56 | install: ../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 |
64 | distclean: clean |
65 | ||
66 | clean: | |
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 | |
72 | dinstall: ${DEBS} | |
73 | dpkg -i ${DEBS} | |
74 | ||
75 | .PHONY: upload | |
76 | upload: ${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 |