.PHONY: all fmt fmt-check clippy test dupes dupes-cleanup check check-all e2e build install help
all: check
fmt:
cargo fmt
fmt-check:
cargo fmt -- --check
clippy:
cargo clippy --all-targets --all-features -- -D warnings
test:
cargo test --all-targets --all-features
dupes:
@test -x "$$(command -v cargo-dupes)" || (echo "cargo-dupes not found. Installing..." && cargo install cargo-dupes --version 0.2.1 --locked)
cargo dupes check
dupes-cleanup:
@test -x "$$(command -v cargo-dupes)" || (echo "cargo-dupes not found. Installing..." && cargo install cargo-dupes --version 0.2.1 --locked)
cargo dupes cleanup --dry-run
check: fmt-check clippy test dupes
build:
cargo build --release --all-features
ifeq ($(OS),Windows_NT)
EXT := .exe
else
EXT :=
endif
CARGO_HOME ?= $(HOME)/.cargo
DESTDIR ?= $(CARGO_HOME)/bin
install: build
@mkdir -p "$(DESTDIR)"
@cp -f target/release/knot-server$(EXT) "$(DESTDIR)/knot-server$(EXT)"
@echo "Installed binary to $(DESTDIR):"
@echo " - knot-server$(EXT)"
e2e:
./tests/run_all_e2e.sh
check-all: check e2e
help:
@echo "Available targets:"
@echo " make (or make all) - Default target: alias for 'make check'"
@echo " make check - Run all local quality gates (fmt-check, clippy, test, dupes)"
@echo " make check-all - Run all local quality gates AND E2E integration tests"
@echo " make fmt - Auto-fix code formatting with cargo fmt"
@echo " make fmt-check - Verify code formatting with cargo fmt -- --check"
@echo " make clippy - Run linter checks with cargo clippy"
@echo " make test - Run unit tests"
@echo " make dupes - Run code duplication check with cargo-dupes (auto-installs if missing)"
@echo " make dupes-cleanup - Show stale duplication suppressions"
@echo " make build - Build release binary"
@echo " make install - Build release binary and copy it to ~/.cargo/bin"
@echo " make e2e - Run all E2E integration tests (requires Docker)"