diff --git a/pve-rs/Makefile b/pve-rs/Makefile index 68ff6dc..e452772 100644 --- a/pve-rs/Makefile +++ b/pve-rs/Makefile @@ -20,11 +20,18 @@ PM_DIR := PVE ifeq ($(BUILD_MODE), release) CARGO_BUILD_ARGS += --release +TARGET_DIR=release +else +TARGET_DIR=debug endif all: PVE Proxmox/Lib/PVE.pm ifneq ($(BUILD_MODE), skip) cargo build $(CARGO_BUILD_ARGS) + mkdir -p test/Proxmox/Lib + sed -r -e \ + 's@^sub libdirs.*$$@sub libdirs { return ("../target/$(TARGET_DIR)", "../../target/$(TARGET_DIR)"); }@' \ + Proxmox/Lib/PVE.pm >test/Proxmox/Lib/PVE.pm endif PVE: ../scripts/genpackage.pl @@ -38,6 +45,9 @@ Proxmox/Lib/PVE.pm: ../Proxmox/Lib/template.pm mkdir -p Proxmox/Lib $(call package_template,PVE,pve_rs,../) +check: all + $(MAKE) -C test test + # always re-create this dir # but also copy the local target/ and PVE/ dirs as a build-cache .PHONY: build diff --git a/pve-rs/test/Makefile b/pve-rs/test/Makefile index dc0a5bd..29dc955 100644 --- a/pve-rs/test/Makefile +++ b/pve-rs/test/Makefile @@ -1,4 +1,9 @@ .PHONY: test -test: +test: Proxmox/Lib/PVE.pm @echo "-- running pve-rs tests --" - ./resource_scheduling.pl + perl -I. -I.. -I../.. ./resource_scheduling.pl + +# The test stub, we don't know where to look for the library from in here! +Proxmox/Lib/PVE.pm: + @echo "run 'make' in the pve-rs/ dir first" + @exit 1