Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Fixup makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Nov 4, 2023
1 parent 9423c95 commit 3f9b4e9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,25 @@ 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)

# Builds the reth binary natively.
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:
Expand All @@ -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.
#
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 4 additions & 0 deletions bin/reth/src/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
Expand Down

0 comments on commit 3f9b4e9

Please sign in to comment.