github.com/spg/deis@v1.7.3/deisctl/Makefile (about)

     1  include ../includes.mk
     2  
     3  # the filepath to this repository, relative to $GOPATH/src
     4  repo_path = github.com/deis/deis/deisctl
     5  
     6  GO_FILES = deisctl.go deisctl_test.go
     7  GO_PACKAGES = backend client cmd config units utils
     8  GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
     9  
    10  COMPONENT = $(notdir $(repo_path))
    11  IMAGE =  $(IMAGE_PREFIX)/$(COMPONENT):$(BUILD_TAG)
    12  
    13  build:
    14  	CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' .
    15  
    16  installer:
    17  	rm -rf dist && mkdir -p dist
    18  	CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o dist/deisctl .
    19  	@if [ ! -d makeself ]; then git clone -b single-binary https://github.com/deis/makeself.git; fi
    20  	PATH=./makeself:$$PATH BINARY=deisctl makeself.sh --bzip2 --current --nox11 dist \
    21  		dist/deisctl-`cat deis-version`-`go env GOOS`-`go env GOARCH`.run "Deis Control Utility" \
    22  		"./deisctl refresh-units \
    23  		&& echo \
    24  		&& echo '\033[0;36mdeisctl\033[0m is in the current directory and unit files are' \
    25  		&& echo 'in \$$HOME/.deis/units. Please move \033[0;36mdeisctl\033[0m to a' \
    26  		&& echo 'directory in your search PATH.' \
    27  		&& echo \
    28  		&& echo 'See http://docs.deis.io/ for documentation.' \
    29  		&& echo"
    30  
    31  install:
    32  	godep go install -v .
    33  
    34  setup-root-gotools:
    35  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v golang.org/x/tools/cmd/cover
    36  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v golang.org/x/tools/cmd/vet
    37  	sudo rm -rf /tmp/tmpGOPATH
    38  
    39  setup-gotools:
    40  	go get -u github.com/golang/lint/golint
    41  	go get -u golang.org/x/tools/cmd/cover
    42  	go get -u golang.org/x/tools/cmd/vet
    43  
    44  test: test-style test-unit
    45  
    46  test-style:
    47  # display output, then check
    48  	$(GOFMT) $(GO_PACKAGES) $(GO_FILES)
    49  	@$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
    50  	$(GOVET) $(repo_path) $(GO_PACKAGES_REPO_PATH)
    51  	$(GOLINT) ./...
    52  
    53  test-unit:
    54  	godep go test -v -cover ./...