github.com/jrxfive/nomad@v0.6.1-0.20170802162750-1fef470e89bf/Makefile (about)

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