-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
67 lines (53 loc) · 1.46 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
## Copyright 2018, Shulhan <[email protected]>. All rights reserved.
## Use of this source code is governed by a BSD-style
## license that can be found in the LICENSE file.
COVER_OUT:=cover.out
COVER_HTML:=cover.html
CPU_PROF:=cpu.prof
MEM_PROF:=mem.prof
CIIGO := ${GOBIN}/ciigo
VERSION := $(shell git describe --tags)
.PHONY: all install build docs docs-serve clean distclean
.PHONY: lint test test.prof
all: lint build test
install:
go install ./cmd/...
build: BUILD_FLAGS=-ldflags "-s -w -X 'git.sr.ht/~shulhan/pakakeh.go.Version=$(VERSION)'"
build:
mkdir -p _bin/
go build \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
$(BUILD_FLAGS) -o _bin/ ./cmd/...
test:
CGO_ENABLED=1 go test -failfast -timeout=1m -race -coverprofile=$(COVER_OUT) ./...
go tool cover -html=$(COVER_OUT) -o $(COVER_HTML)
test.prof:
go test -race -timeout=1m -cpuprofile $(CPU_PROF) -memprofile $(MEM_PROF) ./...
lint:
-fieldalignment ./...
-shadow ./...
-golangci-lint run \
--presets bugs,metalinter,performance,unused \
--disable bodyclose \
--disable exhaustive \
--disable fatcontext \
--disable gosec \
--disable musttag \
./...
$(CIIGO):
go install git.sr.ht/~shulhan/ciigo/cmd/ciigo
docs: $(CIIGO)
ciigo convert _doc
docs-serve: $(CIIGO)
ciigo -address 127.0.0.1:21019 serve _doc
clean:
rm -f $(COVER_OUT) $(COVER_HTML)
rm -f ./**/${CPU_PROF}
rm -f ./**/${MEM_PROF}
rm -f ./**/$(COVER_OUT)
rm -f ./**/$(COVER_HTML)
distclean:
go clean -i ./...