-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
58 lines (43 loc) · 1.02 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
SOURCES := $(wildcard *.go) $(wildcard */*.go)
PNGS := sample/plain.png sample/pretty.png
.DEFAULT_GOAL := all
.PHONY: all
all: build test coverage lint
.PHONY: lint
lint:
golangci-lint run
.PHONY: pngs
pngs: $(PNGS)
.PHONY: build
build: $(SOURCES)
go build ./...
.PHONY: clean
clean:
find . -name "*.dot" -delete
find . -name "*.png" -delete
rm -f coverage*.out coverage*.html
rm -rf site
.PHONY: clean-cache
clean-cache:
go clean -cache -testcache ./...
.PHONY: test
test: $(SOURCES)
go test -race ./...
.PHONY: test-v
test-v: $(SOURCES)
go test -race -v ./...
.PHONY: coverage
coverage: coverage.out coverage.html
go tool cover -func=$<
behavior: behavior.out behavior.html
go tool cover -func=$<
coverage.out: $(SOURCES)
go test -race -cover -coverprofile=$@ ./...
behavior.out: $(SOURCES)
go test -race -run ".*Behavior" -coverprofile=$@ ./...
%.html: %.out
go tool cover -html=$< -o $@
%.png: %.dot
dot -Tpng -o $@ $<
sample/%.dot: sample/sample.go
cd $(shell dirname $<) && go run $(shell basename $<)