From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2 proxmox-backup 3/5] Makefile: switch path based on build mode and target
Date: Mon, 13 Jan 2025 15:42:24 +0100 [thread overview]
Message-ID: <20250113144226.467408-4-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250113144226.467408-1-c.ebner@proxmox.com>
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@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
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-01-13 14:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 14:42 [pbs-devel] [PATCH v2 proxmox-backup 0/5] fix 4788: statically linked proxmox-backup-client Christian Ebner
2025-01-13 14:42 ` [pbs-devel] [PATCH v2 proxmox 1/1] http: client: make https connector generic over resolver Christian Ebner
2025-01-13 14:42 ` [pbs-devel] [PATCH v2 proxmox-backup 2/5] fix: 4788: Makefile: target for statically linked client binary Christian Ebner
2025-01-13 14:42 ` Christian Ebner [this message]
2025-01-13 14:42 ` [pbs-devel] [PATCH v2 proxmox-backup 4/5] cargo: add stubs for `ipconfig` windows build dependency Christian Ebner
2025-01-13 14:42 ` [pbs-devel] [PATCH v2 proxmox-backup 5/5] client: http: Use custom resolver for statically linked binary Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250113144226.467408-4-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox