[pbs-devel] [PATCH v2 proxmox-backup 3/5] Makefile: switch path based on build mode and target
Christian Ebner
c.ebner at proxmox.com
Mon Jan 13 15:42:24 CET 2025
Define variables for the compile path and target and use these
instead of hard-coding the path. Allows to easily switch between
debug and release mode for compilation.
Also, place the libsystemd stub into its own subdirectory for cleaner
separation from the compiled artifacts.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 1:
- use dedicated variables for compile dir and build target
- place libsystemd stub into dedicated directory for clear separation
Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 00e7f7401..428ef40b9 100644
--- a/Makefile
+++ b/Makefile
@@ -36,11 +36,15 @@ SUBCRATES != cargo metadata --no-deps --format-version=1 \
| grep "$$PWD/" \
| sed -e "s!.*$$PWD/!!g" -e 's/\#.*$$//g' -e 's/)$$//g'
+STATIC_TARGET ?= x86_64-unknown-linux-gnu
+
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
+STATIC_COMPILEDIR := target/$(STATIC_TARGET)/release
else
COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/debug
+STATIC_COMPILEDIR := target/$(STATIC_TARGET)/debug
endif
ifeq ($(valgrind), yes)
@@ -230,9 +234,9 @@ upload: $(SERVER_DEB) $(CLIENT_DEB) $(RESTORE_DEB) $(DOC_DEB)
.PHONY: proxmox-backup-client-static
proxmox-backup-client-static:
- mkdir -p target/release/deps/ && \
- echo '!<arch>' > target/release/deps/libsystemd.a # workaround for to greedy linkage and proxmox-systemd
- RUSTFLAGS='-C target-feature=+crt-static -C strip=debuginfo' \
+ mkdir -p $(STATIC_COMPILEDIR)/deps-stubs/ && \
+ echo '!<arch>' > $(STATIC_COMPILEDIR)/deps-stubs/libsystemd.a # workaround for to greedy linkage and proxmox-systemd
+ RUSTFLAGS='-C target-feature=+crt-static -C strip=debuginfo -L $(STATIC_COMPILEDIR)/deps-stubs/' \
$(CARGO) build $(CARGO_BUILD_ARGS) \
--package proxmox-backup-client --bin proxmox-backup-client \
- --target x86_64-unknown-linux-gnu
+ --target $(STATIC_TARGET)
--
2.39.5
More information about the pbs-devel
mailing list