2019-07-10 15:43:49 +03:00
i n c l u d e / u s r / s h a r e / d p k g / a r c h i t e c t u r e . m k
i n c l u d e / u s r / s h a r e / d p k g / p k g - i n f o . m k
i n c l u d e d e f i n e s . m k
GITVERSION := $( shell git rev-parse HEAD)
SUBDIRS := etc
i f e q ( $( BUILD_MODE ) , r e l e a s e )
CARGO_BUILD_ARGS += --release
COMPILEDIR := target/release
e l s e
COMPILEDIR := target/debug
e n d i f
SERVICE_BIN := pve-lxc-syscalld
COMPILED_BINS := \
$( addprefix $( COMPILEDIR) /,$( SERVICE_BIN) )
2020-01-21 17:51:42 +03:00
DEB = $( PACKAGE) _$( DEB_VERSION) _$( DEB_HOST_ARCH) .deb
DSC = rust-$( PACKAGE) _$( DEB_VERSION) .dsc
2019-07-10 15:43:49 +03:00
all : cargo -build $( SUBDIRS )
.PHONY : $( SUBDIRS )
$(SUBDIRS) :
$( MAKE) -C $@
.PHONY : cargo -build
cargo-build :
cargo build $( CARGO_BUILD_ARGS)
2019-09-03 13:42:11 +03:00
.PHONY : test
test :
2021-05-12 22:03:24 +03:00
cargo test $( CARGO_BUILD_ARGS)
2020-01-22 12:01:56 +03:00
.PHONY : check
check : test
.PHONY : san
san :
cargo +nightly fmt -- --check
2019-09-03 13:42:22 +03:00
cargo clippy
2020-01-22 12:01:56 +03:00
cargo test
2019-09-03 13:42:11 +03:00
2019-07-10 15:43:49 +03:00
$(COMPILED_BINS) : cargo -build
install : $( COMPILED_BINS )
2020-01-22 12:07:52 +03:00
install -dm755 $( DESTDIR) $( LIBEXECDIR) /pve-lxc-syscalld
2019-07-10 15:43:49 +03:00
$( foreach i,$( SERVICE_BIN) , \
2020-01-22 12:07:52 +03:00
install -m755 $( COMPILEDIR) /$( i) $( DESTDIR) $( LIBEXECDIR) /pve-lxc-syscalld/ ; )
2019-07-10 15:43:49 +03:00
2020-01-21 17:51:42 +03:00
.PHONY : build
build :
rm -rf build
debcargo package \
--config debian/debcargo.toml \
--changelog-ready \
--no-overlay-write-back \
--directory build \
pve-lxc-syscalld \
$( shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//' )
sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
cat build/debian/control.src build/debian/control.in > build/debian/control
rm build/debian/control.in build/debian/control.src
rm build/Cargo.lock
find build/debian -name "*.hint" -delete
2020-01-22 11:59:59 +03:00
echo system >build/rust-toolchain
2019-07-10 15:43:49 +03:00
$( foreach i,$( SUBDIRS) , \
2020-01-21 17:51:42 +03:00
$( MAKE) -C build/$( i) clean ; )
2019-07-10 15:43:49 +03:00
.PHONY : deb
2020-01-21 18:02:34 +03:00
deb : $( DEB )
$(DEB) : build
2020-01-21 17:51:42 +03:00
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles= nodoc
2020-01-21 18:02:34 +03:00
lintian $( DEB)
2019-07-10 15:43:49 +03:00
2021-06-10 14:08:38 +03:00
upload : deb
dcmd --deb rust-pve-lxc-syscalld_*.changes \
| grep -v '.changes$$' \
| tar -cf- -T- \
| ssh -X repoman@repo.proxmox.com upload --product pve --dist bullseye
2019-07-10 15:43:49 +03:00
.PHONY : dsc
dsc : $( DSC )
2020-01-21 17:51:42 +03:00
$(DSC) : build
cd build; dpkg-buildpackage -S -us -uc -d -nc
2019-07-10 15:43:49 +03:00
lintian $( DSC)
2020-01-22 12:03:21 +03:00
.PHONY : dinstall
dinstall :
$( MAKE) deb
sudo -k dpkg -i $( DEB)
2019-07-10 15:43:49 +03:00
clean :
$( foreach i,$( SUBDIRS) , \
$( MAKE) -C $( i) clean ; )
cargo clean
2020-01-21 17:51:42 +03:00
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build