summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 2bdf654d99e68ff1e046d4645784b42c1c980be6 (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
DOTNET ?= dotnet
CONFIGURATION ?= Release
SOLUTION := Cepis.sln
LIBRARY := src/Cepis/Cepis.csproj
ARTIFACTS := artifacts

.DEFAULT_GOAL := help
.PHONY: help test lint format build pack check clean

help:
	@echo 'Targets:'
	@echo '  test       run the suite against a local HTTP server'
	@echo '  lint       dotnet format --verify-no-changes + build -warnaserror (read-only)'
	@echo '  format     apply dotnet format (writes)'
	@echo '  build      build the solution in $(CONFIGURATION)'
	@echo '  pack       the NuGet package into $(ARTIFACTS)'
	@echo '  check      lint + test + build, in that order'
	@echo '  clean      remove build output'
	@echo
	@echo 'Override the configuration with e.g. make build CONFIGURATION=Debug'

test:
	$(DOTNET) test $(SOLUTION) -c $(CONFIGURATION)

lint:
	$(DOTNET) format $(SOLUTION) --verify-no-changes --severity warn
	$(DOTNET) build $(SOLUTION) -c $(CONFIGURATION) -warnaserror

format:
	$(DOTNET) format $(SOLUTION) --severity warn

build:
	$(DOTNET) build $(SOLUTION) -c $(CONFIGURATION)

pack:
	$(DOTNET) pack $(LIBRARY) -c $(CONFIGURATION) -o $(ARTIFACTS)

check: lint test build

clean:
	$(DOTNET) clean $(SOLUTION) -c $(CONFIGURATION) || true
	rm -rf $(ARTIFACTS)
	find . -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +