github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/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  	golang.org/x/tools/cmd/vet \
     9  	github.com/axw/gocov/gocov \
    10  	gopkg.in/matm/v1/gocov-html \
    11  	github.com/ugorji/go/codec/codecgen
    12  
    13  GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
    14  
    15  all: test
    16  
    17  dev: format generate
    18  	@NOMAD_DEV=1 sh -c "'$(PWD)/scripts/build.sh'"
    19  
    20  bin: generate
    21  	@sh -c "'$(PWD)/scripts/build.sh'"
    22  
    23  release:
    24  	@$(MAKE) bin
    25  
    26  cov:
    27  	gocov test ./... | gocov-html > /tmp/coverage.html
    28  	open /tmp/coverage.html
    29  
    30  test: generate
    31  	@sh -c "'$(PWD)/scripts/test.sh'"
    32  	@$(MAKE) vet
    33  
    34  cover:
    35  	go list ./... | xargs -n1 go test --cover
    36  
    37  format:
    38  	@echo "--> Running go fmt"
    39  	@go fmt $(PACKAGES)
    40  
    41  generate:
    42  	@echo "--> Running go generate"
    43  	@go generate $(PACKAGES)
    44  	@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
    45  	@mv structs.gen.tmp nomad/structs/structs.generated.go
    46  
    47  vet:
    48  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    49  		go get golang.org/x/tools/cmd/vet; \
    50  	fi
    51  	@echo "--> Running go tool vet $(VETARGS) ${GOFILES_NOVENDOR}"
    52  	@go tool vet $(VETARGS) ${GOFILES_NOVENDOR} ; if [ $$? -eq 1 ]; then \
    53  		echo ""; \
    54  		echo "[LINT] Vet found suspicious constructs. Please check the reported constructs"; \
    55  		echo "and fix them if necessary before submitting the code for review."; \
    56  	fi
    57  
    58  	@git grep -n `echo "log"".Print"` | grep -v 'vendor/' ; if [ $$? -eq 0 ]; then \
    59  		echo "[LINT] Found "log"".Printf" calls. These should use Nomad's logger instead."; \
    60  	fi
    61  
    62  web:
    63  	./scripts/website_run.sh
    64  
    65  web-push:
    66  	./scripts/website_push.sh
    67  
    68  # bootstrap the build by downloading additional tools
    69  bootstrap:
    70  	@for tool in  $(EXTERNAL_TOOLS) ; do \
    71  		echo "Installing $$tool" ; \
    72      go get $$tool; \
    73  	done
    74  
    75  travis:
    76  	@sudo apt-get install -y qemu
    77  	@sh -c "'$(PWD)/scripts/update_docker.sh'"
    78  	@sh -c "'$(PWD)/scripts/install_rkt.sh'"
    79  
    80  .PHONY: all bin cov integ test vet web web-push test-nodep