# Development tasks. Everything runs through `zig`, so there is nothing to # install first. # # make list the targets # make test run the suite # make lint formatting check + full type check, no files touched # make build release build of the library and the CLI ZIG ?= zig # Passed to `zig build` for the targets that produce binaries. OPTIMIZE ?= ReleaseSafe .DEFAULT_GOAL := help .PHONY: help test lint format build check clean docs run help: @echo 'Targets:' @echo ' test run the unit and integration tests' @echo ' lint zig fmt --check + zig build check (read-only)' @echo ' format apply zig fmt (writes)' @echo ' build build the library and the cepis CLI (OPTIMIZE=$(OPTIMIZE))' @echo ' check lint + test + build, in that order' @echo ' docs generate the API documentation into zig-out/docs' @echo ' run build and run the CLI: make run ARGS="01001000"' @echo ' clean remove build artefacts and the local cache' test: $(ZIG) build test --summary all # Read-only by design, so it is safe in CI and in a pre-commit hook: it reports # what `make format` would change without changing anything, and type-checks # every module including the tests. lint: $(ZIG) fmt --check build.zig src test $(ZIG) build check format: $(ZIG) fmt build.zig src test build: $(ZIG) build -Doptimize=$(OPTIMIZE) docs: $(ZIG) build-lib src/root.zig -femit-docs=zig-out/docs -fno-emit-bin run: $(ZIG) build run -- $(ARGS) # The order matters: lint is the fastest to fail, build the slowest, so a broken # run reports the cheapest problem first. check: lint test build clean: rm -rf zig-out .zig-cache