Debian Codegraph @

GNUmakefile

raw
1 .PHONY: \
2 all \
3 dep \
4 depup \
5 update \
6 build \
7 install \
8 lint \
9 vet \
10 fmt \
11 fmtcheck \
12 clean \
13 pretest \
14 test
15
16 SRCS = $(shell git ls-files '*.go')
17 PKGS = $(shell go list ./... | grep -v /vendor/)
18 COVERAGE_PKGS = $(shell go list ./... | grep -Ev "/testing|/examples")
19
20 all: dep build test
21
22 dep:
23 go get -u github.com/golang/dep/...
24 dep ensure
25
26 depup:
27 go get -u github.com/golang/dep/...
28 dep ensure -u
29
30 build: main.go dep
31 go build -o go-cpe $<
32
33
34 lint:
35 @ go get -v github.com/golang/lint/golint
36 $(foreach file,$(SRCS),golint $(file) || exit;)
37
38 vet:
39 go vet $(PKGS) || exit;
40
41 fmt:
42 gofmt -w $(SRCS)
43
44 fmtcheck:
45 @ $(foreach file,$(SRCS),gofmt -s -l $(file);)
46 cov:
47 sh coverage.sh $(COVERAGE_PKGS) || exit;
48 go tool cover -html=coverage.out -o coverage.html
49
50 clean:
51 go clean $(shell glide nv)
52
53 pretest: vet fmtcheck
54
55 test: pretest
56 @ $(foreach pkg,$(PKGS), go test $(pkg) || exit;)