1
Fork 0
undocker/Makefile

51 lines
1.0 KiB
Makefile
Raw Normal View History

2021-06-01 08:49:39 +03:00
GODEPS = $(shell git ls-files '*.go' go.mod go.sum)
2021-06-01 09:07:32 +03:00
GOBIN = $(shell go env GOPATH)/bin/
2021-06-01 08:49:39 +03:00
2021-08-23 16:29:41 +03:00
GOOSARCHS = linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64/.exe
define undockertarget
TARGETS += undocker-$(strip $(1))-$(strip $(2))$(firstword $(3))
undocker-$(strip $(1))-$(strip $(2))$(firstword $(3)): $(GODEPS)
CGO_ENABLED=0 GOOS=$(strip $(1)) GOARCH=$(strip $(2)) go build -o $$@
endef
$(foreach goosarch,$(GOOSARCHS), \
$(eval $(call undockertarget,\
$(word 1,$(subst /, ,$(goosarch))),\
$(word 2,$(subst /, ,$(goosarch))),\
$(word 3,$(subst /, ,$(goosarch))),\
)))
2021-06-01 19:54:55 +03:00
2021-08-23 16:29:41 +03:00
.PHONY: all
all: $(TARGETS) coverage.html
2021-06-01 08:49:39 +03:00
2021-06-01 08:42:23 +03:00
.PHONY: test
test:
2021-06-01 09:00:27 +03:00
go test -race -cover ./...
.PHONY: lint
2021-06-01 19:47:45 +03:00
lint: vet staticcheck
.PHONY: vet
vet:
2021-06-01 09:00:27 +03:00
go vet ./...
2021-06-01 19:47:45 +03:00
.PHONY: staticcheck
staticcheck:
2021-06-01 09:10:10 +03:00
$(GOBIN)staticcheck -f stylish ./...
2021-06-01 08:42:23 +03:00
.INTERMEDIATE: coverage.out
2021-06-01 08:49:39 +03:00
coverage.out: $(GODEPS)
2021-06-01 08:42:23 +03:00
go test -coverprofile $@ ./...
coverage.html: coverage.out
go tool cover -html=$< -o $@
2021-06-01 19:54:55 +03:00
.PHONY: clean
clean:
2021-08-23 16:29:41 +03:00
rm -f coverage.html $(TARGETS)