.PHONY=all test testjson vet vetjson cov covhtml clean

# build binary
all:
	go build -tags='sqlite_fts5' -ldflags='-s -w'

# run all tests
test:
	go test -tags='sqlite_fts5' -cover ./...

# run all tests, print result to stdout as json
testjson:
	go test -json -cover ./...

# run go vet
vet:
	go vet ./...

# run go vet, print results to stdout as json
vetjson:
	go vet -json ./...

# generate test coverage profile, print results to stdout
cov:
	go test -coverprofile=coverage.out ./... && \
	  go tool cover -func=coverage.out

# generate test coverage profile, render results as html, show
# in browser
covhtml:
	go test -coverprofile=coverage.out ./... && \
	  go tool cover -html=coverage.out -o coverage.html && \
    xdg-open ./coverage.html

# run go clean
clean:
	go clean