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 {} +