undocker/Makefile

30 lines
742 B
Makefile
Raw Normal View History

2021-08-24 14:23:31 +00:00
SCRIPTS = $(shell awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(shell git ls-files))
2021-06-01 05:49:39 +00:00
GODEPS = $(shell git ls-files '*.go' go.mod go.sum)
2021-08-24 03:47:38 +00:00
2021-08-24 10:57:30 +00:00
VSN ?= $(shell git describe --dirty)
2021-08-24 04:02:12 +00:00
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 $@
2021-08-24 04:02:12 +00:00
.PHONY: test
test: coverage.out
2021-06-01 06:00:27 +00:00
.PHONY: lint
2021-08-24 14:23:31 +00:00
lint:
2021-06-01 06:00:27 +00:00
go vet ./...
2021-09-06 06:01:05 +00:00
$(shell go env GOPATH)/bin/staticcheck -f stylish ./...
2021-08-24 14:23:31 +00:00
shellcheck $(SCRIPTS)
2021-06-01 05:42:23 +00:00
.INTERMEDIATE: coverage.out
2021-06-01 05:49:39 +00:00
coverage.out: $(GODEPS)
go test -race -cover -coverprofile $@ ./...
2021-06-01 05:42:23 +00:00
coverage.html: coverage.out
go tool cover -html=$< -o $@
2021-06-01 16:54:55 +00:00
.PHONY: clean
clean:
2022-08-29 15:02:17 +00:00
rm -f undocker coverage.html