.PHONY: bootstrap setup test lint fmt fmt-check check docker hooks build run

# Makefile targets are thin shims; the implementations live in script/
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
# of README.md). build and run are for working on the code by hand.

# The version the binary reports. It comes from git, so it is computed
# here on the host; the Dockerfile is passed it as a build argument.
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)

bootstrap:
	@script/bootstrap

setup:
	@script/setup

test:
	@script/test

lint:
	@script/lint

fmt:
	@script/fmt

fmt-check:
	@script/fmt-check

check:
	@script/check

docker:
	@script/docker

hooks:
	@script/install-precommit

build:
	go build -trimpath -ldflags "-X main.Version=$(VERSION)" \
		-o bin/smallwebwaf ./cmd/smallwebwaf

run: build
	./bin/smallwebwaf
