44 lines
773 B
Makefile
44 lines
773 B
Makefile
|
CARGO ?= cargo
|
||
|
|
||
|
define to_upper
|
||
|
$(shell echo "$(1)" | tr '[:lower:]' '[:upper:]')
|
||
|
endef
|
||
|
|
||
|
ifeq ($(BUILD_MODE), release)
|
||
|
CARGO_BUILD_ARGS += --release
|
||
|
endif
|
||
|
|
||
|
.PHONY: all
|
||
|
all:
|
||
|
ifeq ($(BUILD_TARGET), pve)
|
||
|
$(MAKE) pve
|
||
|
else ifeq ($(BUILD_TARGET), pmg)
|
||
|
$(MAKE) pve
|
||
|
else
|
||
|
@echo "Run 'make pve' or 'make pmg'"
|
||
|
endif
|
||
|
|
||
|
.PHONY: pve pmg
|
||
|
pve pmg:
|
||
|
@PERLMOD_PRODUCT=$(call to_upper,$@) \
|
||
|
$(CARGO) $(CARGO_BUILD_ARGS) build -p $@-rs
|
||
|
|
||
|
build:
|
||
|
mkdir build
|
||
|
echo system >build/rust-toolchain
|
||
|
cp -a ./perl-* ./build/
|
||
|
cp -a ./pve-rs ./pmg-rs ./build
|
||
|
|
||
|
pve-deb: build
|
||
|
cd ./build/pve-rs && dpkg-buildpackage -b -uc -us
|
||
|
touch $@
|
||
|
|
||
|
pmg-deb: build
|
||
|
cd ./build/pmg-rs && dpkg-buildpackage -b -uc -us
|
||
|
touch $@
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
cargo clean
|
||
|
rm -rf ./build ./PVE ./PMG ./pve-deb ./pmg-deb
|