From 59c7b8587ed58bba76aab1cc70600a5dcb22c264 Mon Sep 17 00:00:00 2001 From: Tyler Fanelli Date: Wed, 6 Nov 2024 22:35:41 -0500 Subject: [PATCH] as/Makefile: Allow conditional features Supplying a FEATURES argument to the attestation service's Makefile can conditionally compile features into the build. The FEATURES argument will disable default features and instead supply the selected features. For example `FEATURES=restful-bin,rvps-grpc,snp-verifier make grpc-as` will expand to: cargo build --bin grpc-as --release \ --no-default-features \ --features grpc-bin,restful-bin,rvps-grpc,snp-verifier Signed-off-by: Tyler Fanelli --- attestation-service/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/attestation-service/Makefile b/attestation-service/Makefile index 60e285b12..67ca32953 100644 --- a/attestation-service/Makefile +++ b/attestation-service/Makefile @@ -8,6 +8,16 @@ BIN_NAMES := grpc-as restful-as DEBUG ?= DESTDIR ?= $(PREFIX)/bin +FEATURES ?= + +ifdef FEATURES + OPTIONAL_FEATURES := ,$(FEATURES) + default-features := --no-default-features +else + OPTIONAL_FEATURES := + default-features := +endif + ifdef DEBUG release := TARGET_DIR := $(TARGET_DIR)/debug @@ -19,10 +29,10 @@ endif build: grpc-as restful-as grpc-as: - cargo build --bin grpc-as $(release) --features grpc-bin + cargo build --bin grpc-as $(release) $(default-features) --features grpc-bin$(OPTIONAL_FEATURES) restful-as: - cargo build --bin restful-as $(release) --features restful-bin + cargo build --bin restful-as $(release) $(default-features) --features restful-bin$(OPTIONAL_FEATURES) install: for bin_name in $(BIN_NAMES); do \