diff --git a/Makefile b/Makefile index b5e342c54..81bc03a8c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: deps deps-linux deps-macos compile-programs-asm compile-programs-rust compile-bench \ -compile-programs clean-asm clean-rust clean-bench clean-shared clean test test-asm test-no-compile \ -test-asm-no-compile test-rust test-rust-no-compile test-executor flamegraph-prover \ +compile-programs clean-asm clean-rust clean-bench clean-shared clean test test-asm \ +test-rust test-executor test-flamegraph flamegraph-prover \ test-fast test-prover test-prover-all test-disk-spill test-math-cuda test-cuda-integration \ bench-math-cuda bench-prover bench-prover-cuda build check clippy fmt lint regen-ethrex-fixtures \ update-ethrex-fixture-checksums check-ethrex-fixture-checksums @@ -35,7 +35,8 @@ BENCH_ARTIFACTS_DIR=./executor/program_artifacts/bench SHARED_TARGET_DIR=./executor/shared_target -ASM_PROGRAMS = $(wildcard $(ASM_PROGRAMS_DIR)/*.s) +ASM_PROGRAMS := $(wildcard $(ASM_PROGRAMS_DIR)/*.s) +ASM_ARTIFACTS := $(patsubst $(ASM_PROGRAMS_DIR)/%.s,$(ASM_ARTIFACTS_DIR)/%.elf,$(ASM_PROGRAMS)) RUST_PROGRAM_DIRS := $(dir $(wildcard $(RUST_PROGRAMS_DIR)/*/Cargo.toml)) RUST_PROGRAMS := $(notdir $(basename $(RUST_PROGRAM_DIRS:%/=%))) @@ -120,12 +121,13 @@ prepare-sysroot: fi; \ fi -compile-programs-asm: - @mkdir -p $(ASM_ARTIFACTS_DIR) - @set -e; for src in $(ASM_PROGRAMS); do \ - echo "$(CLANG) $(ASM_CFLAGS) $(ASM_LDFLAGS) $$src -o $(ASM_ARTIFACTS_DIR)/$$(basename $$src .s).elf"; \ - $(CLANG) $(ASM_CFLAGS) $(ASM_LDFLAGS) $$src -o $(ASM_ARTIFACTS_DIR)/$$(basename $$src .s).elf; \ - done +compile-programs-asm: $(ASM_ARTIFACTS) + +$(ASM_ARTIFACTS_DIR): + mkdir -p $@ + +$(ASM_ARTIFACTS_DIR)/%.elf: $(ASM_PROGRAMS_DIR)/%.s | $(ASM_ARTIFACTS_DIR) + $(CLANG) $(ASM_CFLAGS) $(ASM_LDFLAGS) $< -o $@ compile-programs-rust: prepare-sysroot $(RUST_ARTIFACTS) @@ -134,14 +136,19 @@ compile-bench: prepare-sysroot $(BENCH_ARTIFACTS) compile-programs: compile-programs-asm compile-programs-rust compile-bench +$(RUST_ARTIFACTS_DIR): + mkdir -p $@ + +$(BENCH_ARTIFACTS_DIR): + mkdir -p $@ + # Compile rust (64-bit) # Order-only `| prepare-sysroot` so a direct `make .../foo.elf` provisions the sysroot # first (the aggregate compile-programs-rust/compile-bench targets already do, but a # bare pattern-rule invocation like `make -B .../ethrex.elf` would otherwise skip it # and fail to compile guest C dependencies). Order-only because prepare-sysroot is # .PHONY — a normal prereq would force a rebuild every time; its recipe is idempotent. -$(RUST_ARTIFACTS_DIR)/%.elf: $(RUST_PROGRAMS_DIR)/%/Cargo.toml | prepare-sysroot - @mkdir -p $(RUST_ARTIFACTS_DIR) +$(RUST_ARTIFACTS_DIR)/%.elf: $(RUST_PROGRAMS_DIR)/%/Cargo.toml | prepare-sysroot $(RUST_ARTIFACTS_DIR) cd $(RUST_PROGRAMS_DIR)/$* && \ CARGO_TARGET_DIR=$(abspath $(SHARED_TARGET_DIR)) \ CFLAGS_riscv64im_lambda_vm_elf="$(SYSROOT_CFLAGS)" \ @@ -153,8 +160,7 @@ $(RUST_ARTIFACTS_DIR)/%.elf: $(RUST_PROGRAMS_DIR)/%/Cargo.toml | prepare-sysroot cp $(SHARED_TARGET_DIR)/riscv64im-lambda-vm-elf/release/$* $@ # Compile rust benches (64-bit) -$(BENCH_ARTIFACTS_DIR)/%.elf: $(BENCH_PROGRAMS_DIR)/%/Cargo.toml | prepare-sysroot - @mkdir -p $(BENCH_ARTIFACTS_DIR) +$(BENCH_ARTIFACTS_DIR)/%.elf: $(BENCH_PROGRAMS_DIR)/%/Cargo.toml | prepare-sysroot $(BENCH_ARTIFACTS_DIR) cd $(BENCH_PROGRAMS_DIR)/$* && \ CARGO_TARGET_DIR=$(abspath $(SHARED_TARGET_DIR)) \ CFLAGS_riscv64im_lambda_vm_elf="$(SYSROOT_CFLAGS)" \ @@ -179,22 +185,15 @@ clean-shared: clean: clean-asm clean-rust clean-bench clean-shared -test-executor: compile-programs test-no-compile - -test-asm: compile-programs-asm test-asm-no-compile +test-executor: compile-programs + cargo test -p executor -test-asm-no-compile: +test-asm: compile-programs-asm cargo test -p executor --test asm test-rust: compile-programs-rust cargo test -p executor --test rust -test-rust-no-compile: - cargo test -p executor --test rust - -test-no-compile: - cargo test -p executor - test-flamegraph: cargo test -p executor --test flamegraph