# Set to "--offline" to run cargo in offline mode.
OFFLINE =

# Which tests to run? This applies for `cargo test`.
TESTS =

# Build binaries for this target. Unset to use default for toolchain.
BUILD_FOR = x86_64-unknown-linux-musl

# Construct cargo option for build target, if needed.
ifdef BUILD_FOR
TARGET_OPTION = --target $(BUILD_FOR)
else
TARGET_OPTION =
endif

all: clippy test

check clippy:
	cargo clippy --all-targets --locked $(OFFLINE) -- -Dwarnings

build: clippy
	cargo build --all-targets $(TARGET_OPTION) --locked $(OFFLINE)

test: build
	cargo test $(TARGET_OPTION) --locked $(OFFLINE) -- ${TESTS}

mutants:
	cargo mutants -e 'src/bin/**/*.rs'
