From 72a4b451c9d06f7a97cac2f43f1b7f52fafcd3b7 Mon Sep 17 00:00:00 2001 From: Murilo Ijanc Date: Sun, 26 Jul 2026 12:18:32 -0300 Subject: Initial import --- Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..344f4e3 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +SWIFT ?= swift +CONFIGURATION ?= debug + +.DEFAULT_GOAL := help +.PHONY: help test lint format build check clean + +help: + @echo 'Targets:' + @echo ' test run the test suite' + @echo ' lint swift-format lint, read-only' + @echo ' format apply swift-format in place (writes)' + @echo ' build compile the library (CONFIGURATION=$(CONFIGURATION))' + @echo ' check lint + test + build, in that order' + @echo ' clean remove build artefacts' + @echo + @echo 'Override the toolchain with e.g. make test SWIFT=/path/to/swift' + @echo 'Build a release with make build CONFIGURATION=release' + +test: + $(SWIFT) test + +lint: + @if $(SWIFT) format --version >/dev/null 2>&1; then \ + $(SWIFT) format lint --strict --recursive Package.swift Sources Tests; \ + else \ + echo 'swift-format is not in this toolchain (needs Swift 6 or swift-format on PATH); skipping'; \ + fi + +format: + @if $(SWIFT) format --version >/dev/null 2>&1; then \ + $(SWIFT) format --in-place --recursive Package.swift Sources Tests; \ + else \ + echo 'swift-format is not in this toolchain (needs Swift 6 or swift-format on PATH); skipping'; \ + fi + +build: + $(SWIFT) build -c $(CONFIGURATION) + +check: lint test build + +clean: + $(SWIFT) package clean + rm -rf .build -- cgit v1.3