]>
Commit | Line | Data |
---|---|---|
50754a46 WB |
1 | CARGO ?= cargo |
2 | ||
50754a46 WB |
3 | ifeq ($(BUILD_MODE), release) |
4 | CARGO_BUILD_ARGS += --release | |
9fcecb2c | 5 | else |
50754a46 WB |
6 | endif |
7 | ||
8 | .PHONY: all | |
9 | all: | |
10 | ifeq ($(BUILD_TARGET), pve) | |
11 | $(MAKE) pve | |
12 | else ifeq ($(BUILD_TARGET), pmg) | |
4beb3570 | 13 | $(MAKE) pmg |
50754a46 | 14 | else |
4beb3570 WB |
15 | @echo "Run one of" |
16 | @echo " - make pve" | |
17 | @echo " - make pmg" | |
50754a46 WB |
18 | endif |
19 | ||
50754a46 | 20 | build: |
9fcecb2c | 21 | rm -rf build |
50754a46 WB |
22 | mkdir build |
23 | echo system >build/rust-toolchain | |
29181c7a | 24 | cp -a ./Cargo.toml ./build |
4beb3570 | 25 | cp -a ./common ./build |
ec79616b | 26 | cp -a ./pve-rs ./build |
b6274a49 | 27 | cp -a ./pmg-rs ./build |
932d602d WB |
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 | |
4beb3570 WB |
34 | # So the common packages end up in ./build, rather than ./build/common |
35 | mv ./build/common/pkg ./build/common-pkg | |
34a00686 WB |
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 |