From 3f9b4e937980e26b3c5dadb77738f4a6a5f9892c Mon Sep 17 00:00:00 2001 From: clabby Date: Sat, 4 Nov 2023 15:09:58 +0100 Subject: [PATCH] Fixup makefile --- Cargo.toml | 1 + Makefile | 15 +++++++++++---- bin/reth/src/ethereum.rs | 2 +- bin/reth/src/optimism.rs | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 04108abd1eb3..10ef5bf2beab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ members = [ "examples/beacon-api-sse", "examples/trace-transaction-cli" ] +default-members = ["bin/reth"] # Explicitly set the resolver to version 2, which is the default for packages with edition >= 2021 # https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html diff --git a/Makefile b/Makefile index 91910c899051..b24f56411359 100644 --- a/Makefile +++ b/Makefile @@ -42,15 +42,15 @@ help: ## Display this help. .PHONY: install install: ## Build and install the reth binary under `~/.cargo/bin`. - cargo install --path bin/reth-ethereum --bin reth --force --locked \ + cargo install --path bin/reth --bin reth --force --locked \ --features "$(FEATURES)" \ --profile "$(PROFILE)" \ $(CARGO_INSTALL_EXTRA_FLAGS) .PHONY: install-op -install: ## Build and install the op-reth binary under `~/.cargo/bin`. - cargo install --path bin/reth-optimism --bin op-reth --force --locked \ - --features "$(FEATURES)" \ +install-op: ## Build and install the op-reth binary under `~/.cargo/bin`. + cargo install --path bin/reth --bin op-reth --force --locked \ + --features "optimism,$(FEATURES)" \ --profile "$(PROFILE)" \ $(CARGO_INSTALL_EXTRA_FLAGS) @@ -58,6 +58,9 @@ install: ## Build and install the op-reth binary under `~/.cargo/bin`. build-native-%: cargo build --bin reth --target $* --features "$(FEATURES)" --profile "$(PROFILE)" +op-build-native-%: + cargo build --bin op-reth --target $* --features "optimism,$(FEATURES)" --profile "$(PROFILE)" + # The following commands use `cross` to build a cross-compile. # # These commands require that: @@ -77,6 +80,10 @@ build-%: RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \ cross build --bin reth --target $* --features "$(FEATURES)" --profile "$(PROFILE)" +op-build-%: + RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \ + cross build --bin op-reth --target $* --features "optimism,$(FEATURES)" --profile "$(PROFILE)" + # Unfortunately we can't easily use cross to build for Darwin because of licensing issues. # If we wanted to, we would need to build a custom Docker image with the SDK available. # diff --git a/bin/reth/src/ethereum.rs b/bin/reth/src/ethereum.rs index afb46a3222fc..d7c841d3827f 100644 --- a/bin/reth/src/ethereum.rs +++ b/bin/reth/src/ethereum.rs @@ -4,7 +4,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; #[cfg(feature = "optimism")] -compile_error!("run --bin op-reth for Optimism"); +compile_error!("Cannot build the `reth` binary with the `optimism` feature flag enabled. Did you mean to build `op-reth`?"); #[cfg(not(feature = "optimism"))] fn main() { diff --git a/bin/reth/src/optimism.rs b/bin/reth/src/optimism.rs index 220b04d9d0e7..554b91a3ae28 100644 --- a/bin/reth/src/optimism.rs +++ b/bin/reth/src/optimism.rs @@ -3,6 +3,10 @@ #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; +#[cfg(not(feature = "optimism"))] +compile_error!("Cannot build the `op-reth` binary with the `optimism` feature flag disabled. Did you mean to build `reth`?"); + +#[cfg(feature = "optimism")] fn main() { if let Err(err) = reth::cli::run() { eprintln!("Error: {err:?}");