github.com/mattyr/nomad@v0.3.3-0.20160919021406-3485a065154a/GNUmakefile (about) 1 PACKAGES = $(shell go list ./... | grep -v '/vendor/') 2 VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \ 3 -nilfunc -printf -rangeloops -shift -structtags -unsafeptr 4 EXTERNAL_TOOLS=\ 5 github.com/kardianos/govendor \ 6 github.com/mitchellh/gox \ 7 golang.org/x/tools/cmd/cover \ 8 github.com/axw/gocov/gocov \ 9 gopkg.in/matm/v1/gocov-html \ 10 github.com/ugorji/go/codec/codecgen 11 12 GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") 13 14 all: test 15 16 dev: format generate 17 @NOMAD_DEV=1 sh -c "'$(PWD)/scripts/build.sh'" 18 19 bin: generate 20 @sh -c "'$(PWD)/scripts/build.sh'" 21 22 release: 23 @$(MAKE) bin 24 25 cov: 26 gocov test ./... | gocov-html > /tmp/coverage.html 27 open /tmp/coverage.html 28 29 test: generate 30 @echo "--> Running go fmt" ; 31 @if [ -n "`go fmt ${PACKAGES}`" ]; then \ 32 echo "[ERR] go fmt updated formatting. Please commit formatted code first."; \ 33 exit 1; \ 34 fi 35 @sh -c "'$(PWD)/scripts/test.sh'" 36 @$(MAKE) vet 37 38 cover: 39 go list ./... | xargs -n1 go test --cover 40 41 format: 42 @echo "--> Running go fmt" 43 @go fmt $(PACKAGES) 44 45 generate: 46 @echo "--> Running go generate" 47 @go generate $(PACKAGES) 48 @sed -e 's|github.com/hashicorp/nomad/vendor/github.com/ugorji/go/codec|github.com/ugorji/go/codec|' nomad/structs/structs.generated.go >> structs.gen.tmp 49 @mv structs.gen.tmp nomad/structs/structs.generated.go 50 51 vet: 52 @go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \ 53 go get golang.org/x/tools/cmd/vet; \ 54 fi 55 @echo "--> Running go tool vet $(VETARGS) ${GOFILES_NOVENDOR}" 56 @go tool vet $(VETARGS) ${GOFILES_NOVENDOR} ; if [ $$? -eq 1 ]; then \ 57 echo ""; \ 58 echo "[LINT] Vet found suspicious constructs. Please check the reported constructs"; \ 59 echo "and fix them if necessary before submitting the code for review."; \ 60 fi 61 62 @git grep -n `echo "log"".Print"` | grep -v 'vendor/' ; if [ $$? -eq 0 ]; then \ 63 echo "[LINT] Found "log"".Printf" calls. These should use Nomad's logger instead."; \ 64 fi 65 66 web: 67 ./scripts/website_run.sh 68 69 web-push: 70 ./scripts/website_push.sh 71 72 # bootstrap the build by downloading additional tools 73 bootstrap: 74 @for tool in $(EXTERNAL_TOOLS) ; do \ 75 echo "Installing $$tool" ; \ 76 go get $$tool; \ 77 done 78 79 install: bin/nomad 80 install -o root -g wheel -m 0755 ./bin/nomad /usr/local/bin/nomad 81 82 travis: 83 @sh -c "'$(PWD)/scripts/travis.sh'" 84 85 .PHONY: all bin cov integ test vet web web-push test-nodep