forked from hashicorp/consul-replicate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (48 loc) · 1.75 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
59
TEST?=./...
NAME?=$(shell basename "${CURDIR}")
VERSION = $(shell awk -F\" '/^const Version/ { print $$2; exit }' main.go)
EXTERNAL_TOOLS=\
github.com/mitchellh/gox
default: test
# bin generates the binaries for all platforms.
bin: generate
@sh -c "'${CURDIR}/scripts/build.sh' '${NAME}'"
# dev creates binares for testing locally - they are put into ./bin and $GOPATH.
dev: generate
@DEV=1 sh -c "'${CURDIR}/scripts/build.sh' '${NAME}'"
# dist creates the binaries for distibution.
dist:
@sh -c "'${CURDIR}/scripts/dist.sh' '${NAME}' '${VERSION}'"
# integration runs the integration tests
integration: generate
@sh -c "'$(CURDIR)/scripts/integration.sh'"
# test runs the test suite and vets the code.
test: generate
@echo "==> Running tests..."
@go list $(TEST) \
| grep -v "github.com/hashicorp/${NAME}/vendor" \
| xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS}
# testrace runs the race checker
testrace: generate
@echo "==> Running tests (race)..."
@go list $(TEST) \
| grep -v "github.com/hashicorp/${NAME}/vendor" \
| xargs -n1 go test -timeout=60s -race ${TESTARGS}
# updatedeps installs all the dependencies needed to run and build.
updatedeps:
@sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'"
# generate runs `go generate` to build the dynamically generated source files.
generate:
@echo "==> Generating..."
@find . -type f -name '.DS_Store' -delete
@go list ./... \
| grep -v "github.com/hashicorp/${NAME}/vendor" \
| xargs -n1 go generate
# bootstrap installs the necessary go tools for development/build.
bootstrap:
@echo "==> Bootstrapping..."
@for t in ${EXTERNAL_TOOLS}; do \
echo "--> Installing "$$t"..." ; \
go get -u "$$t"; \
done
.PHONY: default bin dev dist integration test testrace updatedeps vet generate bootstrap