]> git.proxmox.com Git - proxmox-perl-rs.git/blob - Makefile
bump proxmox-tfa dep to 4.0.2
[proxmox-perl-rs.git] / Makefile
1 CARGO ?= cargo
2
3 ifeq ($(BUILD_MODE), release)
4 CARGO_BUILD_ARGS += --release
5 else
6 endif
7
8 .PHONY: all
9 all:
10 ifeq ($(BUILD_TARGET), pve)
11 $(MAKE) pve
12 else ifeq ($(BUILD_TARGET), pmg)
13 $(MAKE) pmg
14 else
15 @echo "Run one of"
16 @echo " - make pve"
17 @echo " - make pmg"
18 endif
19
20 build:
21 rm -rf build
22 mkdir build
23 echo system >build/rust-toolchain
24 cp -a ./Cargo.toml ./build
25 cp -a ./common ./build
26 cp -a ./pve-rs ./build
27 cp -a ./pmg-rs ./build
28 # Replace the symlinks with copies of the common code in pve/pmg:
29 cd build; for i in pve pmg; do \
30 rm ./$$i-rs/common ; \
31 mkdir ./$$i-rs/common ; \
32 cp -R ./common/src ./$$i-rs/common/src ; \
33 done
34 # So the common packages end up in ./build, rather than ./build/common
35 mv ./build/common/pkg ./build/common-pkg
36 # Copy the workspace root into the sources
37 mkdir build/pve-rs/.workspace
38 cp -t build/pve-rs/.workspace Cargo.toml
39 sed -i -e '/\[package\]/a\workspace = ".workspace"' build/pve-rs/Cargo.toml
40 # Clear the member array and replace it with ".."
41 sed -i -e '/^members = \[/,/^]$$/d' build/pve-rs/.workspace/Cargo.toml
42 sed -i -e '/^\[workspace\]/a\members = [ ".." ]' build/pve-rs/.workspace/Cargo.toml
43 # Copy the cargo config
44 mkdir build/pve-rs/.cargo
45 cp -t build/pve-rs/.cargo .cargo/config