github.com/ryanslade/nomad@v0.2.4-0.20160128061903-fc95782f2089/Makefile (about)

     1  PACKAGES = $(shell go list ./...)
     2  VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
     3           -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
     4  EXTERNAL_TOOLS=\
     5  	github.com/tools/godep \
     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  
    12  all: test
    13  
    14  dev: deps format
    15  	@NOMAD_DEV=1 sh -c "'$(PWD)/scripts/build.sh'"
    16  
    17  bin:
    18  	@sh -c "'$(PWD)/scripts/build.sh'"
    19  
    20  release: updatedeps
    21  	@$(MAKE) bin
    22  
    23  cov:
    24  	gocov test ./... | gocov-html > /tmp/coverage.html
    25  	open /tmp/coverage.html
    26  
    27  deps:
    28  	@echo "--> Installing build dependencies"
    29  	@DEP_ARGS="-d -v" sh -c "'$(PWD)/scripts/deps.sh'"
    30  
    31  updatedeps: deps
    32  	@echo "--> Updating build dependencies"
    33  	@DEP_ARGS="-d -f -u" sh -c "'$(PWD)/scripts/deps.sh'"
    34  
    35  test: deps
    36  	@sh -c "'$(PWD)/scripts/test.sh'"
    37  	@$(MAKE) vet
    38  
    39  cover: deps
    40  	go list ./... | xargs -n1 go test --cover
    41  
    42  format: deps
    43  	@echo "--> Running go fmt"
    44  	@go fmt $(PACKAGES)
    45  
    46  vet:
    47  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    48  		go get golang.org/x/tools/cmd/vet; \
    49  	fi
    50  	@echo "--> Running go tool vet $(VETARGS) ."
    51  	@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
    52  		echo ""; \
    53  		echo "[LINT] Vet found suspicious constructs. Please check the reported constructs"; \
    54  		echo "and fix them if necessary before submitting the code for review."; \
    55  	fi
    56  
    57  	@git grep -n `echo "log"".Print"` ; if [ $$? -eq 0 ]; then \
    58  		echo "[LINT] Found "log"".Printf" calls. These should use Nomad's logger instead."; \
    59  	fi
    60  
    61  web:
    62  	./scripts/website_run.sh
    63  
    64  web-push:
    65  	./scripts/website_push.sh
    66  
    67  # bootstrap the build by downloading additional tools
    68  bootstrap:
    69  	@for tool in  $(EXTERNAL_TOOLS) ; do \
    70  		echo "Installing $$tool" ; \
    71      go get $$tool; \
    72  	done
    73  
    74  .PHONY: all bin cov deps integ test vet web web-push test-nodep