From 82674904c1675ce4a23dc6c062c53b153e79caa9 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sat, 10 Oct 2020 21:14:07 +0200 Subject: [PATCH] Allow to specify a target in the Makefile --- CHANGELOG.md | 2 +- Makefile | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 892af65..a9abd65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - In the configuration, `root_certificates` has been added to the `global` and `endpoint` sections as an array of strings representing the path to root certificate files. - At compilation, it is now possible to statically link OpenSSL using the `openssl_vendored` feature. - +- In the Makefile, it is now possible to specify which target triple to build for. ## [0.12.0] - 2020-09-26 diff --git a/Makefile b/Makefile index 6c2658d..80a1586 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ DATADIR = $(DATAROOTDIR) MAN5DIR = $(DATADIR)/man/man5 MAN8DIR = $(DATADIR)/man/man8 SYSCONFDIR = /etc -TARGET_DIR = ./target/release +TARGET_DIR = ./target/$(TARGET)/release MAN_SRC_DIR = ./man/en MAN_DST_DIR = $(TARGET_DIR)/man @@ -18,11 +18,19 @@ update: cargo update acmed: - cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)" + if test -n "$(TARGET)"; then \ + cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \ + else \ + cargo build --release --manifest-path "acmed/Cargo.toml" --no-default-features --features "$(FEATURES)"; \ + fi strip "$(TARGET_DIR)/acmed" tacd: - cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)" + if test -n "$(TARGET)"; then \ + cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)" --target "$(TARGET)"; \ + else \ + cargo build --release --manifest-path "tacd/Cargo.toml" --no-default-features --features "$(FEATURES)"; \ + fi strip "$(TARGET_DIR)/tacd" man: