github.com/keikoproj/manny@v0.0.0-20210726112440-8571e4c99ced/Makefile (about) 1 BINARY := manny 2 PKGS := $(shell go list ./... | grep -v /vendor) 3 4 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) 5 ifeq (,$(shell go env GOBIN)) 6 GOBIN=$(shell go env GOPATH)/bin 7 else 8 GOBIN=$(shell go env GOBIN) 9 endif 10 11 .PHONY: all build clean spotless test cover release artifactory-upload ${GOBIN}/${BINARY} 12 13 all: vendor test build 14 15 build: ${GOBIN}/${BINARY} 16 17 ${GOBIN}/${BINARY}: 18 go build -o $@ main.go 19 20 clean: 21 @echo "Removing package object files..." 22 @go clean ${PKGS} 23 @echo "Removing cache test results..." 24 @go clean -testcache 25 26 spotless: clean 27 @echo "Removing vendor directory..." 28 @-rm -rf vendor 29 30 vendor: spotless 31 @echo "Refreshing dependencies..." 32 @go mod tidy && go mod vendor 33 34 test: 35 go test ${PKGS} ${TESTARGS} 36 37 cover: TESTARGS=-coverprofile=coverage.out 38 cover: test 39 go tool cover -func=coverage.out -o coverage.txt 40 go tool cover -html=coverage.out -o coverage.html 41 @cat coverage.txt 42 @echo "Run 'open coverage.html' to view coverage report." 43 44 VERSION ?= vlatest 45 PLATFORMS := windows linux darwin 46 os = $(word 1, $@) 47 48 .PHONY: $(PLATFORMS) 49 $(PLATFORMS): 50 mkdir -p release 51 GOOS=$(os) GOARCH=amd64 go build -o release/$(BINARY)-$(VERSION)-$(os)-amd64 52 53 release: windows linux darwin