# List recipes.
default:
    @just --list

# Build the release binary.
build:
    moon build --target native --release

# Build a static binary with Zig's musl toolchain (dist/orbit-linux-x86_64).
build-musl:
    scripts/build-musl.sh

# Run the unit tests.
test:
    moon test --target native

# Prove src/kernel with overflow-checked integers (needs z3, cvc5 or alt-ergo).
prove:
    MOON_PROVE_PRELUDE_OVERRIDE="${MOON_HOME:-$HOME/.moon}/lib/prelude_proof_machine_int" moon prove src/kernel

# Install Orbit to ~/.local/bin and set up its package PATH for Bash.
install: build
    install -Dm755 _build/native/release/build/main/main.exe "$HOME/.local/bin/orbit"
    @line='export PATH="${ORBIT_ROOT:-$HOME/.orbit}/bin:$PATH"'; rc="$HOME/.bashrc"; \
      if [ ! -f "$rc" ] || ! grep -Fqx -- "$line" "$rc"; then \
        printf '\n%s\n' "$line" >> "$rc"; \
      fi
