-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (32 loc) · 1004 Bytes
/
Makefile
File metadata and controls
45 lines (32 loc) · 1004 Bytes
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
## Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved.
## Use of this source code is governed by a BSD-style
## license that can be found in the LICENSE file.
SRC:=$(shell go list -f '{{$$d:=.Dir}} {{ range .GoFiles }}{{$$d}}/{{.}} {{end}}' ./...)
SRC_TEST:=$(shell go list -f '{{$$d:=.Dir}} {{ range .TestGoFiles }}{{$$d}}/{{.}} {{end}}' ./...)
COVER_OUT:=cover.out
COVER_HTML:=cover.html
CPU_PROF:=cpu.prof
MEM_PROF:=mem.prof
.PHONY: all install lint
.PHONY: test test.prof coverbrowse
.PHONY: clean distclean
all: install
install: test
go install ./...
test: $(COVER_HTML)
test.prof:
go test -cpuprofile $(CPU_PROF) -memprofile $(MEM_PROF) .
$(COVER_HTML): $(COVER_OUT)
go tool cover -html=$< -o $@
$(COVER_OUT): $(SRC) $(SRC_TEST)
go test -coverprofile=$@ ./... || rm -f $@
coverbrowse: $(COVER_HTML)
xdg-open $<
lint:
golangci-lint run ./...
clean:
rm -rf $(COVER_OUT) $(COVER_HTML)
rm -f ./**/${CPU_PROF}
rm -f ./**/${MEM_PROF}
distclean: clean
go clean -i ./...