undocker/Makefile

30 lines
724 B
Makefile

SCRIPTS = $(shell awk '/#!\/usr\/bin\/env (ba)?sh/&&FNR==1{print FILENAME}' $(shell git ls-files))
GODEPS = $(shell git ls-files '*.go' go.mod go.sum)
VSN ?= $(shell git describe --dirty)
VSNHASH = $(shell git rev-parse --verify HEAD)
LDFLAGS = -ldflags "-X main.Version=$(VSN) -X main.VersionHash=$(VSNHASH)"
undocker: ## builds binary for the current architecture
go build $(LDFLAGS) -o $@
.PHONY: test
test: coverage.out
.PHONY: lint
lint:
go vet ./...
staticcheck -f stylish ./...
shellcheck $(SCRIPTS)
.INTERMEDIATE: coverage.out
coverage.out: $(GODEPS)
go test -race -cover -coverprofile $@ ./...
coverage.html: coverage.out
go tool cover -html=$< -o $@
.PHONY: clean
clean:
rm -f undocker coverage.html