github.com/aminjam/goflat@v0.4.1-0.20160331105230-ec639fc0d5b3/Makefile (about)

     1  GOTOOLS = github.com/mitchellh/gox \
     2  	github.com/FiloSottile/gvt \
     3  	github.com/onsi/ginkgo/ginkgo
     4  PACKAGES=$(shell go list ./... | grep -v vendor | sort | uniq)
     5  FILES=$(shell find . -name "*.go" -type f | grep -v vendor)
     6  VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
     7           -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
     8  BINARY_NAME=$(shell basename ${PWD})
     9  MAIN_PACKAGE="./cmd/goflat"
    10  
    11  all: format init test vet build-dist
    12  
    13  build:
    14  	@$(MAKE) -s generate
    15  	@$(CURDIR)/scripts/build.bash $(BINARY_NAME) $(MAIN_PACKAGE) dev
    16  
    17  build-dist:
    18  	@$(MAKE) -s generate
    19  	@$(CURDIR)/scripts/build.bash $(BINARY_NAME) $(MAIN_PACKAGE)
    20  
    21  format:
    22  	@echo "--> Running go fmt"
    23  	@go fmt $(PACKAGES)
    24  
    25  generate:
    26  	@echo "--> Running go generate"
    27  	@go generate
    28  	@$(MAKE) -s format
    29  
    30  test:
    31  	@echo "--> Running Tests"
    32  	@ginkgo -r
    33  
    34  init:
    35  	@echo "--> Init build tools"
    36  	@go get -v $(GOTOOLS)
    37  
    38  update-deps:
    39  	@echo "--> Updating dependencies"
    40  	@$(MAKE) -s init
    41  	@gvt update --all
    42  
    43  vet:
    44  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    45  		go get golang.org/x/tools/cmd/vet; \
    46  	fi
    47  	@echo "--> Running go tool vet $(VETARGS) ."
    48  	@go tool vet $(VETARGS) $(FILES) ; if [ $$? -eq 1 ]; then \
    49  		echo ""; \
    50  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    51  		echo "and fix them if necessary before submitting the code for reviewal."; \
    52  	fi
    53  
    54  .PHONY: all build build-dist format generate init test update-deps
    55  
    56