Debian Codegraph @

GNUmakefile

raw
1 SHELL := bash
2
3 GOTOOLS := github.com/mitchellh/gox
4 VERSION := $(shell awk -F\" '/Version = "(.*)"/ { print $$2; exit }' version/version.go)
5 GITSHA:=$(shell git rev-parse HEAD)
6 GITBRANCH:=$(shell git symbolic-ref --short HEAD 2>/dev/null)
7
8 GOFILES ?= $(shell go list ./...)
9
10 default: test
11
12 # bin generates the releasable binaries
13 bin: tools
14 @sh -c "'$(CURDIR)/scripts/build.sh'"
15
16 cov:
17 go test ./... -coverprofile=coverage.out
18 go tool cover -html=coverage.out
19
20 format:
21 @echo "--> Running go fmt"
22 @go fmt $(GOFILES)
23
24 # dev creates binaries for testing locally - these are put into ./bin and
25 # $GOPATH
26 dev:
27 @SERF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
28
29 # dist creates the binaries for distibution
30 dist:
31 @sh -c "'$(CURDIR)/scripts/dist.sh' $(VERSION)"
32
33 get-tools:
34 go get -u -v $(GOTOOLS)
35
36 # subnet sets up the require subnet for testing on darwin (osx) - you must run
37 # this before running other tests if you are on osx.
38 subnet:
39 @sh -c "'$(CURDIR)/scripts/setup_test_subnet.sh'"
40
41 # test runs the test suite
42 test: subnet vet
43 go test ./...
44
45 # testrace runs the race checker
46 testrace: subnet vet
47 go test -race ./... $(TESTARGS)
48
49 tools:
50 @which gox 2>/dev/null ; if [ $$? -eq 1 ]; then \
51 $(MAKE) get-tools; \
52 fi
53
54 vet:
55 @echo "--> Running go vet"
56 @go vet -tags '$(GOTAGS)' $(GOFILES); if [ $$? -eq 1 ]; then \
57 echo ""; \
58 echo "Vet found suspicious constructs. Please check the reported constructs"; \
59 echo "and fix them if necessary before submitting the code for review."; \
60 exit 1; \
61 fi
62
63 .PHONY: default bin cov format dev dist get-tools subnet test testrace tools vet