2021-11-09 10:51:44 +03:00
CARGO ?= cargo
i f e q ( $( BUILD_MODE ) , r e l e a s e )
2022-03-06 14:26:11 +03:00
CARGO_BUILD_ARGS += --release --offline
2022-02-28 13:57:56 +03:00
DEBUG_LIBPATH :=
e l s e
2021-11-09 10:51:44 +03:00
e n d i f
.PHONY : all
all :
i f e q ( $( BUILD_TARGET ) , p v e )
$( MAKE) pve
e l s e i f e q ( $( BUILD_TARGET ) , p m g )
2022-03-01 11:51:59 +03:00
$( MAKE) pmg
2021-11-09 10:51:44 +03:00
e l s e
2022-03-01 11:51:59 +03:00
@echo "Run one of"
@echo " - make pve"
@echo " - make pmg"
2021-11-09 10:51:44 +03:00
e n d i f
build :
2022-02-28 13:57:56 +03:00
rm -rf build
2021-11-09 10:51:44 +03:00
mkdir build
echo system >build/rust-toolchain
2023-03-07 14:40:49 +03:00
cp -a ./Cargo.toml ./build
2022-03-01 11:51:59 +03:00
cp -a ./common ./build
2021-11-09 11:43:32 +03:00
cp -a ./pve-rs ./build
2021-11-26 16:55:15 +03:00
cp -a ./pmg-rs ./build
2023-05-09 12:29:05 +03:00
# Replace the symlinks with copies of the common code in pve/pmg:
cd build; for i in pve pmg; do \
rm ./$$ i-rs/common ; \
mkdir ./$$ i-rs/common ; \
cp -R ./common/src ./$$ i-rs/common/src ; \
done
2022-03-01 11:51:59 +03:00
# So the common packages end up in ./build, rather than ./build/common
mv ./build/common/pkg ./build/common-pkg
2023-05-17 10:03:49 +03:00
# Copy the workspace root into the sources
mkdir build/pve-rs/.workspace
cp -t build/pve-rs/.workspace Cargo.toml
sed -i -e '/\[package\]/a\workspace = ".workspace"' build/pve-rs/Cargo.toml
# Clear the member array and replace it with ".."
sed -i -e '/^members = \[/,/^]$$/d' build/pve-rs/.workspace/Cargo.toml
sed -i -e '/^\[workspace\]/a\members = [ ".." ]' build/pve-rs/.workspace/Cargo.toml
# Copy the cargo config
mkdir build/pve-rs/.cargo
cp -t build/pve-rs/.cargo .cargo/config