-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (61 loc) · 1.39 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.PHONY: all build buildsnapshot buildtestsnapshot checks checktest checklint checkbats clean distclean gobuild goget goinstall list man manclean show
# targets
CMDS = count norm rows text trim
# metadata
DATE = $(shell date -I)
GOVERSION = $(shell go version | awk '{print $$3}')
# commands
MK = mkdir -p
RM = rm -rf
# directories
MN = man/man1
MD = man/md
# files
MNS = $(addprefix $(MN)/, $(addsuffix .1, $(CMDS)))
MDS = $(addprefix $(MD)/, $(addsuffix .1.md, $(CMDS)))
GZS = $(addsuffix .gz, $(MNS))
all: show clean man
build:
GOVERSION=$(GOVERSION) goreleaser --rm-dist
buildclean:
$(RM) dist/
@echo
buildsnapshot:
GOVERSION=$(GOVERSION) goreleaser --snapshot --rm-dist
buildtestsnapshot:
GOVERSION=$(GOVERSION) goreleaser --snapshot --rm-dist --skip-publish
checks: checktest checklint checkbats
checktest:
go test -v -race $(shell go list ./... | grep -v '/vendor/')
checklint:
golangci-lint run --enable-all --sort-results --verbose
checkbats:
bats bats/
clean: buildclean manclean
distclean: clean
$(RM) *~
@echo
gobuild:
go build ./...
goget:
go get -t ./...
goinstall:
go install ./...
list:
go list -m all
man: $(GZS)
$(MN)/%.1.gz: $(MN)/%.1
gzip $<
$(MN)/%.1: $(MD)/%.1.md
pandoc -s -t man -o $@ $<
manclean:
$(RM) $(MN)
$(MK) $(MN)
@echo
show:
@echo 'CMDS:' $(CMDS)
@echo 'DATE:' $(DATE)
@echo 'GZS :' $(GZS)
@echo 'MNS :' $(MNS)
@echo 'MDS :' $(MDS)
@echo