Skip to content

Commit

Permalink
as/Makefile: Allow conditional features
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tylerfanelli authored and fitzthum committed Nov 7, 2024
1 parent c09afeb commit 59c7b85
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions attestation-service/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit 59c7b85

Please sign in to comment.