summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 12:18:32 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 12:18:32 -0300
commit72a4b451c9d06f7a97cac2f43f1b7f52fafcd3b7 (patch)
tree3e4d33a614b673bc8cd9de1e688245f340cd3e1e /Makefile
downloadswift-957dd1847e2485df70cf64657959ed02c117db1b.tar.gz
Initial importv0.1.0
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 43 insertions, 0 deletions
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