2022-11-15 15:05:50 +03:00
i n c l u d e d e f i n e s . m k
2021-11-09 10:51:44 +03:00
CARGO ?= cargo
i f e q ( $( BUILD_MODE ) , r e l e a s e )
CARGO_BUILD_ARGS += --release
2022-02-28 13:57:56 +03:00
DEBUG_LIBPATH :=
e l s e
DEBUG_LIBPATH := "-L./target/debug" ,
2021-11-09 10:51:44 +03:00
e n d i f
2022-07-08 15:54:22 +03:00
d e f i n e u p l o a d _ t e m p l a t e
cd build; \
dcmd --deb lib$( 1) -rs-perl*.changes \
| grep -v '.changes$$' \
| tar -cf " $@ .tar " -T-; \
cat " $@ .tar " | ssh -X repoman@repo.proxmox.com upload --product $( 2) --dist bullseye
e n d e f
2021-11-09 10:51:44 +03:00
.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
.PHONY : pve pmg
pve pmg :
2022-11-15 15:05:10 +03:00
$( CARGO) build $( CARGO_BUILD_ARGS) -p $@ -rs
2021-11-09 10:51:44 +03:00
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-02-28 13:57:56 +03:00
cp -a ./scripts ./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
2022-02-28 13:57:56 +03:00
cp -a ./Proxmox ./build
2022-11-15 15:06:47 +03:00
cp defines.mk ./build
2022-03-01 11:51:59 +03:00
mv ./build/Proxmox ./build/common/pkg
2022-11-15 15:09:27 +03:00
# The template.pm is required by the products to produce their Proxmox::Lib
mkdir ./build/Proxmox
mkdir ./build/Proxmox/Lib
cp ./Proxmox/Lib/template.pm ./build/Proxmox/Lib
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
2021-11-09 10:51:44 +03:00
pve-deb : build
cd ./build/pve-rs && dpkg-buildpackage -b -uc -us
touch $@
2021-11-26 16:55:15 +03:00
pmg-deb : build
cd ./build/pmg-rs && dpkg-buildpackage -b -uc -us
touch $@
2021-11-09 10:51:44 +03:00
2022-03-01 11:51:59 +03:00
common-deb : build
cd ./build/common-pkg && dpkg-buildpackage -b -uc -us
touch $@
2022-07-08 15:54:22 +03:00
pve-upload : pve -deb
$( call upload_template,pve,pve)
pmg-upload : pmg -deb
$( call upload_template,pmg,pmg)
2022-07-25 12:43:40 +03:00
# need to put into variable to ensure comma isn't interpreted as param separator on call
common_target = pve,pmg
2022-07-08 15:54:22 +03:00
common-upload : common -deb
2022-07-25 12:43:40 +03:00
$( call upload_template,proxmox,$( common_target) )
2021-11-10 13:58:03 +03:00
2021-11-09 10:51:44 +03:00
.PHONY : clean
clean :
cargo clean
2022-05-10 08:13:56 +03:00
rm -rf ./build ./PVE ./PMG ./pve-deb ./pmg-deb ./common-deb