-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (46 loc) · 1.23 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
# 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:
.PHONY: build bench clean cover github install lint print test test-trace trace vet
# Default rule.
build:
go build -o build ./...
# Custom rules.
bench:
go test ${BENCHFLAGS} -bench=. -benchmem ./...
clean:
go mod tidy
go clean
go clean -i
rm -f build/*
cover:
go tool cover -html=build/coverage.out -o=build/coverage.html
github:
git push --follow-tags -u github master
install:
go install ./...
lint:
golint ./...
print:
goprint -font='"Inconsolata" 10pt/12pt' ${GOPKG} > build/pkg.html
prince -o build/pkg.pdf build/pkg.html
test:
go test ${TESTFLAGS} -covermode=${COVERMODE} \
-coverprofile=build/coverage.out ./...
test-trace:
go test ${TESTFLAGS} -trace=build/trace.out ${GOPKG}
trace:
go tool trace build/trace.out
vet:
go vet ./...