.PHONY: help all clean test build release lint fmt check-fmt markdownlint nixie typecheck
APP ?= pg_embedded_setup_unpriv
CARGO ?= cargo
BUILD_JOBS ?=
CLIPPY_FLAGS ?= --all-targets --all-features -- -D warnings
RUSTDOC_FLAGS ?= --cfg docsrs -D warnings
MDLINT ?= markdownlint-cli2
NIXIE ?= nixie
build: target/debug/$(APP)
release: target/release/$(APP)
all: check-fmt lint test
clean:
$(CARGO) clean
test:
RUSTFLAGS="-D warnings" $(CARGO) nextest run --all-targets --all-features $(BUILD_JOBS)
RUSTFLAGS="-D warnings" $(CARGO) nextest run --tests --workspace --no-default-features --features dev-worker $(BUILD_JOBS)
target/%/$(APP):
$(CARGO) build $(BUILD_JOBS) $(if $(findstring release,$(@)),--release) --bin $(APP)
lint:
RUSTDOCFLAGS="$(RUSTDOC_FLAGS)" $(CARGO) doc --workspace --no-deps $(BUILD_JOBS)
$(CARGO) clippy $(CLIPPY_FLAGS)
typecheck:
$(CARGO) check --workspace --all-targets --all-features $(BUILD_JOBS)
fmt:
$(CARGO) fmt --all
mdformat-all
check-fmt:
$(CARGO) fmt --all -- --check
markdownlint:
$(MDLINT) "**/*.md"
nixie:
nixie --no-sandbox
help:
@grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf " %-20s %s\n", $$1, $$2}'