Skip to content

Commit

Permalink
Slightly improve the Makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
egrimley-arm committed Jun 30, 2023
1 parent abab18a commit 6fd0ddf
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
24 changes: 11 additions & 13 deletions workspaces/icecap-host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# See the `LICENSING.markdown` file in the Veracruz root directory for
# licensing and copyright information.

.PHONY: all build clean clean-cargo-lock default doc fmt clippy \
test-dependencies test-collateral test-server test-client veracruz-test \
tests build-tests
.PHONY: all build build-tests build-veracruz-server-test clean \
clean-cargo-lock clippy default doc fmt icecap-runtime \
test-client test-dependencies test-server tests veracruz-test

default: build

Expand Down Expand Up @@ -47,11 +47,11 @@ CLIPPY_OPTIONS = --no-deps -A clippy::type_complexity -A clippy::module_inceptio

all: build test-collateral

build: rustup-plat $(VERACRUZ_ICECAP_QEMU_IMAGE)
build: rustup-plat icecap-runtime
$(COMPILERS) $(BUILD_PARAMETERS) \
cargo build $(PROFILE_FLAG) $(host_feature_flags) $(V_FLAG)

build-veracruz-server-test: rustup-plat $(VERACRUZ_ICECAP_QEMU_IMAGE)
build-veracruz-server-test: rustup-plat icecap-runtime
$(COMPILERS) $(BUILD_PARAMETERS) \
cargo test --no-run $(PROFILE_FLAG) \
$(host_feature_flags) \
Expand All @@ -64,11 +64,12 @@ build-veracruz-server-test: rustup-plat $(VERACRUZ_ICECAP_QEMU_IMAGE)
--message-format=json | jq -r '.executable | select(.)' \
) target/release/veracruz-server-test

.PHONY: $(MEASUREMENT_FILE)
$(MEASUREMENT_FILE):
$(MAKE) -C ../icecap-runtime elfloader css-icecap.bin ICECAP_PLAT=$(ICECAP_PLAT)
measurement-file: icecap-runtime

test-dependencies: test-collateral $(VERACRUZ_ICECAP_QEMU_IMAGE)
icecap-runtime:
$(MAKE) -C ../icecap-runtime elfloader css-icecap.bin ICECAP_PLAT=$(icecap_plat)

test-dependencies: test-collateral icecap-runtime

CARGO_TEST = $(COMPILERS) $(TEST_PARAMETERS) cargo test $(PROFILE_FLAG)

Expand All @@ -84,16 +85,13 @@ test-client: test-dependencies
veracruz-test: test-dependencies build-tests
$(CARGO_TEST) --test integration_test -- --test-threads=1

$(VERACRUZ_ICECAP_QEMU_IMAGE):
$(MAKE) -C ../icecap-runtime elfloader ICECAP_PLAT=$(ICECAP_PLAT)

doc:
cargo doc

fmt:
cargo fmt

clippy: rustup-plat $(VERACRUZ_ICECAP_QEMU_IMAGE)
clippy: rustup-plat icecap-runtime
# workspace members and relevant dependencies
$(BUILD_PARAMETERS) $(COMPILERS) \
cargo clippy $(PROFILE_FLAG) \
Expand Down
2 changes: 1 addition & 1 deletion workspaces/icecap-runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ include $(PROJECT)/icecap.mk

mk_dirs := $(sel4_build_dir) $(elfloader_build_dir) $(misc_build_dir)

$(mk_dirs):
$(mk_dirs) &:
mkdir -p $@

# HACK
Expand Down
16 changes: 9 additions & 7 deletions workspaces/linux-host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# See the `LICENSING.markdown` file in the Veracruz root directory for
# licensing and copyright information.

.PHONY: all build install clean clean-cargo-lock default doc fmt clippy \
test-dependencies test-collateral test-server test-client veracruz-test \
tests build-tests
.PHONY: all build build-tests clean clean-cargo-lock clippy default doc fmt \
install linux-runtime test-client test-collateral test-dependencies \
test-server tests veracruz-test

default: build

Expand Down Expand Up @@ -40,7 +40,7 @@ unresolved_crates_path := $(shell pwd)/crates

all: build test-collateral

build: $(RUNTIME_ENCLAVE_BINARY_PATH)
build: linux-runtime
$(BUILD_ENV) \
cargo build $(PROFILE_FLAG) $(V_FLAG)

Expand All @@ -52,7 +52,7 @@ install:
ln -sf $(BIN_DIR)/linux-veracruz-server $(BIN_DIR)/vc-server
ln -sf $(BIN_DIR)/veracruz-client $(BIN_DIR)/vc-client

test-dependencies: test-collateral $(RUNTIME_ENCLAVE_BINARY_PATH)
test-dependencies: test-collateral linux-runtime

CARGO_TEST = $(BUILD_ENV) $(TEST_PARAMETERS) \
cargo test $(PROFILE_FLAG)
Expand All @@ -69,10 +69,12 @@ test-client: test-dependencies
veracruz-test: test-dependencies build-tests
RUST_LOG="integration_test=info,error" $(CARGO_TEST) --test integration_test -- --test-threads=1 --nocapture

$(RUNTIME_ENCLAVE_BINARY_PATH):
measurement-file: linux-runtime

linux-runtime:
$(MAKE) -C ../linux-runtime linux

clippy: $(RUNTIME_ENCLAVE_BINARY_PATH)
clippy: linux-runtime
# workspace members and relevant dependencies
RUNTIME_ENCLAVE_BINARY_PATH=$(RUNTIME_ENCLAVE_BINARY_PATH) \
cargo clippy $(PROFILE_FLAG) $(V_FLAG) \
Expand Down
13 changes: 7 additions & 6 deletions workspaces/nitro-host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# See the `LICENSING.markdown` file in the Veracruz root directory for
# licensing and copyright information.

.PHONY: all build clean clean-cargo-lock clippy default doc fmt \
test-client test-dependencies test-server veracruz-test build-tests
.PHONY: all build build-tests clean clean-cargo-lock clippy default doc fmt \
nitro-runtime test-client test-dependencies test-server tests veracruz-test

default: build

Expand Down Expand Up @@ -38,11 +38,12 @@ build:
cargo build $(PROFILE_FLAG) $(V_FLAG)
strip -p target/$(PROFILE_PATH)/veracruz-client target/$(PROFILE_PATH)/nitro-veracruz-server

.PHONY: $(MEASUREMENT_FILE)
$(MEASUREMENT_FILE):
measurement-file: nitro-runtime

nitro-runtime:
$(MAKE) -C ../nitro-runtime nitro

test-dependencies: test-collateral
test-dependencies: test-collateral nitro-runtime

CARGO_TEST = $(TEST_PARAMETERS) cargo test $(PROFILE_FLAG) --features nitro

Expand All @@ -66,7 +67,7 @@ doc:
fmt:
cargo fmt

clippy:
clippy: nitro-runtime
# workspace members and relevant dependencies
$(CC) cargo clippy $(PROFILE_FLAG) $(V_FLAG) \
-p veracruz-client \
Expand Down
6 changes: 3 additions & 3 deletions workspaces/shared.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

PLATFORM := $(shell uname)

.PHONY: wasm-files datasets policy-files test-collateral
.PHONY: datasets measurement-file policy-files test-collateral wasm-files

test-collateral: wasm-files datasets $(MEASUREMENT_FILE) policy-files
test-collateral: datasets measurement-file policy-files wasm-files

###################################################
# Wasm programs
Expand Down Expand Up @@ -165,7 +165,7 @@ $(PGEN): $(WORKSPACE_DIR)/host/crates/sdk/generate-policy/src/main.rs \
$(WORKSPACE_DIR)/host/crates/sdk/generate-policy/Cargo.toml
$(MAKE) -C $(WORKSPACE_DIR)/host

policy-files: $(OUT_DIR) $(MEASUREMENT_FILE) $(patsubst %.json, $(OUT_DIR)/%.json, $(POLICY_FILES))
policy-files: $(OUT_DIR) measurement-file $(patsubst %.json, $(OUT_DIR)/%.json, $(POLICY_FILES))
@echo $(INFO_COLOR)"GEN => $(POLICY_FILES)"$(RESET_COLOR)

PROGRAM_DIR = /program/
Expand Down

0 comments on commit 6fd0ddf

Please sign in to comment.