Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

build: better Makefile crate dependency definitions #88

Merged
merged 2 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions rtc_auth_enclave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ CUSTOM_BUILD_PATH := build
CUSTOM_LIBRARY_PATH := $(CUSTOM_BUILD_PATH)/lib
CUSTOM_BIN_PATH := $(CUSTOM_BUILD_PATH)/bin

# XXX: Is there a better way to express this source dependency on rtc_tenclave?
Crate_Files := $(wildcard src/*.rs ../rtc_tenclave/src/*.rs)
# Changes to these files trigger a rebuild of the enclave library (Out_StaticLib).
# This includes the Rust source files of this crate, as well as the workspace crates we depend on.
Crate_Files := $(shell find src ../rtc_tenclave/src ../rtc_types/src -name '*.rs')

Out_StaticLib := $(CRATE_BUILD_PATH)/lib$(CRATE_LIB_NAME).a
Out_Bindings := $(CODEGEN_PATH)/bindings.h

Expand Down Expand Up @@ -84,17 +86,18 @@ $(CODEGEN_PATH):
mkdir -p $(CODEGEN_PATH)

####### Enclave Build ########
#
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
$(Out_StaticLib) $(Out_Bindings): $(Crate_Files)
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
@rm -f $(Out_StaticLib) $(Out_Bindings)
cargo build --release

Expand Down
27 changes: 15 additions & 12 deletions rtc_data_enclave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ CUSTOM_BUILD_PATH := build
CUSTOM_LIBRARY_PATH := $(CUSTOM_BUILD_PATH)/lib
CUSTOM_BIN_PATH := $(CUSTOM_BUILD_PATH)/bin

# XXX: Is there a better way to express this source dependency on rtc_tenclave?
Crate_Files := $(wildcard src/*.rs ../rtc_tenclave/src/*.rs)
# Changes to these files trigger a rebuild of the enclave library (Out_StaticLib).
# This includes the Rust source files of this crate, as well as the workspace crates we depend on.
Crate_Files := $(shell find src ../rtc_tenclave/src ../rtc_types/src -name '*.rs')

Out_StaticLib := $(CRATE_BUILD_PATH)/lib$(CRATE_LIB_NAME).a
Out_Bindings := $(CODEGEN_PATH)/bindings.h

Expand Down Expand Up @@ -84,17 +86,18 @@ $(CODEGEN_PATH):
mkdir -p $(CODEGEN_PATH)

####### Enclave Build ########
#
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
$(Out_StaticLib) $(Out_Bindings): $(Crate_Files)
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
@rm -f $(Out_StaticLib) $(Out_Bindings)
cargo build --release

Expand Down
27 changes: 15 additions & 12 deletions rtc_exec_enclave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ CUSTOM_BUILD_PATH := build
CUSTOM_LIBRARY_PATH := $(CUSTOM_BUILD_PATH)/lib
CUSTOM_BIN_PATH := $(CUSTOM_BUILD_PATH)/bin

# XXX: Is there a better way to express this source dependency on rtc_tenclave?
Crate_Files := $(wildcard src/*.rs ../rtc_tenclave/src/*.rs)
# Changes to these files trigger a rebuild of the enclave library (Out_StaticLib).
# This includes the Rust source files of this crate, as well as the workspace crates we depend on.
Crate_Files := $(shell find src ../rtc_tenclave/src ../rtc_types/src -name '*.rs')

Out_StaticLib := $(CRATE_BUILD_PATH)/lib$(CRATE_LIB_NAME).a
Out_Bindings := $(CODEGEN_PATH)/bindings.h

Expand Down Expand Up @@ -84,17 +86,18 @@ $(CODEGEN_PATH):
mkdir -p $(CODEGEN_PATH)

####### Enclave Build ########
#
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
$(Out_StaticLib) $(Out_Bindings): $(Crate_Files)
# XXX: Make sure cargo build refreshes the output files when this rule executes.
#
# Currently, it's possible for make to consider the output files out of date,
# while cargo considers the build up to date, because cargo resolves with more nuance
# than the crude wildcard function in Crate_Files. When this happens, make gets stuck
# trying to re-run this rule, without cargo touching the output files.
#
# To avoid this edge case, remove the two output files before invoking cargo build.
# This ensures that cargo build recreates them, with timestamps that satisfy make.
#
@rm -f $(Out_StaticLib) $(Out_Bindings)
cargo build --release

Expand Down