forked from hashicorp/consul-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.66 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
TEST?=./...
VERSIONMAJ?=$(shell awk -F\" '/^\tVersion/ { print $$2; exit }' version.go)
VERSIONPRE?=$(shell awk -F\" '/^\tVersionPrerelease/ { print $$2; exit }' version.go)
VERSION?=$(shell if [ "${VERSIONPRE}x" != x ]; then echo "${VERSIONMAJ}-${VERSIONPRE}"; else echo "${VERSIONMAJ}"; fi)
EXTERNAL_TOOLS=\
github.com/mitchellh/gox
default: test
# bin generates the binaries for all platforms.
bin: generate
@sh -c "'${CURDIR}/scripts/build.sh'"
# dev creates binares for testing locally - they are put into ./bin and $GOPATH.
dev: generate
@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
@echo "==> Running tests..."
@go test -timeout=60s -parallel=10 \
$(shell go list $(TEST) | grep -v /vendor/) ${TESTARGS}
# testrace runs the race checker
testrace: generate
@echo "==> Running tests (race)..."
@go test -timeout=60s -race \
$(shell go list $(TEST) | grep -v /vendor/) ${TESTARGS}
# updatedeps installs all the dependencies needed to run and build.
updatedeps:
@sh -c "'${CURDIR}/scripts/deps.sh'"
# generate runs `go generate` to build the dynamically generated source files.
generate:
@echo "==> Generating..."
@find . -type f -name '.DS_Store' -delete
@go generate $(shell go list ./... | grep -v /vendor/) ${TESTARGS}
# 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 test testrace updatedeps vet generate bootstrap