.PHONY: all dupl build test docs
all: build test

build:
	go generate ./...
	go install ./...

dupl:
	find . -name '*.go' \
		| grep -Fv .sql.go \
		| go tool github.com/mibk/dupl -html -t 50 -files \
		> dupl.html
	xdg-open dupl.html

test:
	@mkdir -p unit-test-output
	@go vet ./...
	@CGO_ENABLED=1 go test -cover -coverpkg=./... -coverprofile=unit-test-output/coverage.out -race ./...
	@go tool cover -html=unit-test-output/coverage.out
	@go tool cover -func unit-test-output/coverage.out \
	  | tail -1 | sed 's/[ \t(:][ \t(:]*/ /g;s/)/:/'

docs:
	go tool golang.org/x/pkgsite/cmd/pkgsite -open

# vim:ft=make
#
