blob: 344f4e3962b9f05f2b4b4f0c9b185f272df6a532 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|