diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:48:43 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 12:48:43 -0300 |
| commit | 87166a5299aa551517a86379a0c05eb2110b52b0 (patch) | |
| tree | 3e77e7dd89cca736a22a5f2219451aa57dd99068 /Makefile | |
| download | zig-5e674d123422f5f260d7d857ef211b734480e7dd.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..23f9fa3 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# 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 |