open-consul/GNUmakefile
Sean Chittenden 333ff22e9a Manage dependencies via Godep
Embrace the future and use Go 1.6's vendor support via Godep.

Go 1.5 users should `export GO15VENDOREXPERIMENT=1`
2016-02-12 16:50:37 -08:00

69 lines
1.8 KiB
Makefile

PACKAGES=$(shell go list ./... | grep -v '^github.com/hashicorp/consul/vendor/')
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
VERSION?=$(shell awk -F\" '/^const Version/ { print $$2; exit }' version.go)
all: format
@mkdir -p bin/
@bash --norc -i ./scripts/build.sh
# bin generates the releasable binaries
bin: generate
@sh -c "'$(CURDIR)/scripts/build.sh'"
# dev creates binaries for testing locally - these are put into ./bin and $GOPATH
dev: generate
@CONSUL_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
# dist creates the binaries for distibution
dist: bin
@sh -c "'$(CURDIR)/scripts/dist.sh' $(VERSION)"
cov:
gocov test ./... | gocov-html > /tmp/coverage.html
open /tmp/coverage.html
test:
@$(MAKE) vet
@./scripts/verify_no_uuid.sh
@./scripts/test.sh
cover:
./scripts/verify_no_uuid.sh
go list ./... | xargs -n1 go test --cover
format:
@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
# generate runs `go generate` to build the dynamically generated source files
generate:
find . -type f -name '.DS_Store' -delete
go generate ./...
# generates the static web ui
static-assets:
@echo "--> Generating static assets"
@go-bindata-assetfs -pkg agent -prefix pkg ./pkg/web_ui/...
@mv bindata_assetfs.go command/agent
$(MAKE) format
web:
./scripts/website_run.sh
web-push:
./scripts/website_push.sh
.PHONY: all bin dev dist cov test vet web web-push generate static-assets