]> git.proxmox.com Git - proxmox-perl-rs.git/blob - Makefile
major build system upgrade
[proxmox-perl-rs.git] / Makefile
1 CARGO ?= cargo
2
3 ifeq ($(BUILD_MODE), release)
4 CARGO_BUILD_ARGS += --release
5 DEBUG_LIBPATH :=
6 else
7 DEBUG_LIBPATH := "-L./target/debug",
8 endif
9
10 define upload_template
11 cd build; \
12 dcmd --deb lib$(1)-rs-perl*.changes \
13 | grep -v '.changes$$' \
14 | tar -cf "$@.tar" -T-; \
15 cat "$@.tar" | ssh -X repoman@repo.proxmox.com upload --product $(2) --dist bullseye
16 endef
17
18 .PHONY: all
19 all:
20 ifeq ($(BUILD_TARGET), pve)
21 $(MAKE) pve
22 else ifeq ($(BUILD_TARGET), pmg)
23 $(MAKE) pmg
24 else
25 @echo "Run one of"
26 @echo " - make pve"
27 @echo " - make pmg"
28 endif
29
30 .PHONY: pve pmg
31 pve pmg:
32 $(CARGO) build $(CARGO_BUILD_ARGS) -p $@-rs
33
34 build:
35 rm -rf build
36 mkdir build
37 echo system >build/rust-toolchain
38 cp -a ./Cargo.toml ./build
39 cp -a ./common ./build
40 cp -a ./pve-rs ./build
41 cp -a ./pmg-rs ./build
42 # Replace the symlinks with copies of the common code in pve/pmg:
43 cd build; for i in pve pmg; do \
44 rm ./$$i-rs/common ; \
45 mkdir ./$$i-rs/common ; \
46 cp -R ./common/src ./$$i-rs/common/src ; \
47 done
48 # So the common packages end up in ./build, rather than ./build/common
49 mv ./build/common/pkg ./build/common-pkg
50
51 pve-deb: build
52 cd ./build/pve-rs && dpkg-buildpackage -b -uc -us
53 touch $@
54
55 pmg-deb: build
56 cd ./build/pmg-rs && dpkg-buildpackage -b -uc -us
57 touch $@
58
59 common-deb: build
60 cd ./build/common-pkg && dpkg-buildpackage -b -uc -us
61 touch $@
62
63 pve-upload: pve-deb
64 $(call upload_template,pve,pve)
65 pmg-upload: pmg-deb
66 $(call upload_template,pmg,pmg)
67
68 # need to put into variable to ensure comma isn't interpreted as param separator on call
69 common_target=pve,pmg
70 common-upload: common-deb
71 $(call upload_template,proxmox,$(common_target))
72
73 .PHONY: clean
74 clean:
75 cargo clean
76 rm -rf ./build ./PVE ./PMG ./pve-deb ./pmg-deb ./common-deb