-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (57 loc) · 1.31 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
# Copyright 2019 Manlio Perillo. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# A Makefile template for Go projects.
# Exported variable definitions.
export GO111MODULE := on
# Imported variables.
# GOPKG - used to select the target package
# Variable definitions.
BENCHFLAGS := -v
COVERMODE := atomic # atomic is necessary if the -race flag is enabled
TESTFLAGS := -race -v
# Standard rules.
.POSIX:
# Default rule.
.PHONY: build
build:
go build -o build ./...
# Custom rules.
.PHONY: bench
bench:
go test ${BENCHFLAGS} -bench=. -benchmem ./...
.PHONY: clean
clean:
go mod tidy
go clean
go clean -i
rm -f build/*
.PHONY: cover
cover:
go tool cover -html=build/coverage.out -o=build/coverage.html
.PHONY: github
github:
git push --follow-tags -u github master
.PHONY: install
install:
go install ./...
.PHONY: lint
lint:
golint ./...
.PHONY: print
print:
goprint -font='"Inconsolata" 10pt/12pt' ${GOPKG} > build/pkg.html
prince -o build/pkg.pdf build/pkg.html
.PHONY: test
test:
go test ${TESTFLAGS} -covermode=${COVERMODE} \
-coverprofile=build/coverage.out ./...
.PHONY: test-trace
test-trace:
go test ${TESTFLAGS} -trace=build/trace.out ${GOPKG}
.PHONY: trace
trace:
go tool trace build/trace.out
.PHONY: vet
vet:
go vet ./...