forked from hashicorp/consul-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (33 loc) · 1.2 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
TEST?=./...
NAME?=$(shell basename "$(CURDIR)")
VERSION = $(shell awk -F\" '/^const Version/ { print $$2; exit }' main.go)
default: test
# bin generates the releasable binaries
bin:
@sh -c "'$(CURDIR)/scripts/build.sh'"
# dev creates binaries for testing locally. There are put into ./bin and $GOPATH
dev:
@DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
# dist creates the binaries for distibution
dist:
@sh -c "'$(CURDIR)/scripts/dist.sh' $(VERSION)"
# test runs the test suite and vets the code
test: generate
go list $(TEST) | xargs -n1 go test -timeout=60s -parallel=10 $(TESTARGS)
# testrace runs the race checker
testrace: generate
go list $(TEST) | xargs -n1 go test -race $(TESTARGS)
# updatedeps installs all the dependencies Consul Template needs to run and
# build
updatedeps:
go get -u github.com/mitchellh/gox
go list ./... \
| xargs go list -f '{{ join .Deps "\n" }}{{ printf "\n" }}{{ join .TestImports "\n" }}' \
| grep -v github.com/hashicorp/$(NAME) \
| xargs go get -f -u -v
# generate runs `go generate` to build the dynamically generated
# source files.
generate:
find . -type f -name '.DS_Store' -delete
go generate ./...
.PHONY: default bin dev dist test testrace updatedeps generate