2015-06-01 11:46:21 +00:00
|
|
|
PACKAGES = $(shell go list ./...)
|
|
|
|
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
|
|
|
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
2015-09-14 02:04:06 +00:00
|
|
|
EXTERNAL_TOOLS=\
|
|
|
|
github.com/tools/godep \
|
|
|
|
github.com/mitchellh/gox \
|
|
|
|
golang.org/x/tools/cmd/cover \
|
|
|
|
golang.org/x/tools/cmd/vet
|
|
|
|
|
2015-09-30 19:39:05 +00:00
|
|
|
all: test
|
2015-06-01 11:46:21 +00:00
|
|
|
|
2015-09-30 19:39:05 +00:00
|
|
|
dev: deps format
|
|
|
|
@NOMAD_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
|
2015-06-01 11:46:21 +00:00
|
|
|
|
2015-09-28 06:21:12 +00:00
|
|
|
bin:
|
2015-09-28 06:21:00 +00:00
|
|
|
@sh -c "'$(CURDIR)/scripts/build.sh'"
|
|
|
|
|
2015-06-01 11:46:21 +00:00
|
|
|
cov:
|
|
|
|
gocov test ./... | gocov-html > /tmp/coverage.html
|
|
|
|
open /tmp/coverage.html
|
|
|
|
|
|
|
|
deps:
|
|
|
|
@echo "--> Installing build dependencies"
|
2015-09-30 19:39:05 +00:00
|
|
|
@DEP_ARGS="-d -v" sh -c "'$(CURDIR)/scripts/deps.sh'"
|
2015-06-01 11:46:21 +00:00
|
|
|
|
|
|
|
updatedeps: deps
|
|
|
|
@echo "--> Updating build dependencies"
|
2015-09-30 19:39:05 +00:00
|
|
|
@DEP_ARGS="-d -f -u" sh -c "'$(CURDIR)/scripts/deps.sh'"
|
2015-06-01 11:46:21 +00:00
|
|
|
|
|
|
|
test: deps
|
2015-09-30 19:39:05 +00:00
|
|
|
@sh -c "'$(CURDIR)/scripts/test.sh'"
|
2015-06-01 11:46:21 +00:00
|
|
|
@$(MAKE) vet
|
|
|
|
|
|
|
|
cover: deps
|
|
|
|
go list ./... | xargs -n1 go test --cover
|
|
|
|
|
|
|
|
format: deps
|
|
|
|
@echo "--> Running go fmt"
|
|
|
|
@go fmt $(PACKAGES)
|
|
|
|
|
|
|
|
vet:
|
|
|
|
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
|
|
|
|
go get golang.org/x/tools/cmd/vet; \
|
|
|
|
fi
|
|
|
|
@echo "--> Running go tool vet $(VETARGS) ."
|
|
|
|
@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
|
|
|
|
echo ""; \
|
|
|
|
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
|
|
|
echo "and fix them if necessary before submitting the code for reviewal."; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
web:
|
|
|
|
./scripts/website_run.sh
|
|
|
|
|
|
|
|
web-push:
|
|
|
|
./scripts/website_push.sh
|
|
|
|
|
2015-09-14 02:04:06 +00:00
|
|
|
# bootstrap the build by downloading additional tools
|
|
|
|
bootstrap:
|
|
|
|
@for tool in $(EXTERNAL_TOOLS) ; do \
|
|
|
|
echo "Installing $$tool" ; \
|
|
|
|
go get $$tool; \
|
|
|
|
done
|
|
|
|
|
2015-09-28 06:21:27 +00:00
|
|
|
.PHONY: all bin cov deps integ test vet web web-push test-nodep
|