forked from hairyhenderson/go-fsimpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (52 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.DEFAULT_GOAL = test
extension = $(patsubst windows,.exe,$(filter windows,$(1)))
GOOS ?= $(shell go version | sed 's/^.*\ \([a-z0-9]*\)\/\([a-z0-9]*\)/\1/')
GOARCH ?= $(shell go version | sed 's/^.*\ \([a-z0-9]*\)\/\([a-z0-9]*\)/\2/')
ifeq ("$(TARGETVARIANT)","")
ifneq ("$(GOARM)","")
TARGETVARIANT := v$(GOARM)
endif
else
ifeq ("$(GOARM)","")
GOARM ?= $(subst v,,$(TARGETVARIANT))
endif
endif
ifeq ("$(CI)","true")
LINT_PROCS ?= 1
else
LINT_PROCS ?= $(shell nproc)
endif
test:
CGO_ENABLED=0 go test -coverprofile=c.out ./...
test-race:
go test -race -coverprofile=c.out ./...
bin/fscli_%v7$(call extension,$(GOOS)): $(shell find . -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) \
GOARCH=$(shell echo $* | cut -f2 -d- ) \
GOARM=7 \
CGO_ENABLED=0 \
go build $(BUILD_ARGS) -o $@ ./examples/fscli
bin/fscli_windows-%.exe: $(shell find . -type f -name "*.go")
GOOS=windows \
GOARCH=$* \
GOARM= \
CGO_ENABLED=0 \
go build $(BUILD_ARGS) -o $@ ./examples/fscli
bin/fscli_%$(TARGETVARIANT)$(call extension,$(GOOS)): $(shell find . -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) \
GOARCH=$(shell echo $* | cut -f2 -d- ) \
GOARM=$(GOARM) \
CGO_ENABLED=0 \
go build $(BUILD_ARGS) -o $@ ./examples/fscli
lint:
@golangci-lint run --verbose --max-same-issues=0 --max-issues-per-linter=0
ci-lint:
@golangci-lint run --verbose --max-same-issues=0 --max-issues-per-linter=0 --out-format=github-actions
ifneq ("$(VERSION)","")
release:
git tag -sm "Releasing v$(VERSION)" v$(VERSION) && git push --tags
gh release create v$(VERSION) --draft --generate-notes
endif
.PHONY: test lint ci-lint
.DELETE_ON_ERROR:
.SECONDARY: