CC=go BUILD=build -v -trimpath VERSION=$(shell cat VERSION) GCFLAGS=-gcflags '-e' LDFLAGS=-ldflags '-X main.version=$(VERSION) -s -w' PROGRAM=vipman CMD=-o vipman cmd/vipman/main.go ENV=CGO_ENABLED=0 GO111MODULE=on all: $(PROGRAM) setup: $(CC) get -u github.com/client9/misspell release: clean generate gofmt codeqa $(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD) release-vendor: clean generate gofmt codeqa $(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD) vendor: clean generate gofmt $(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD) $(PROGRAM): clean generate gofmt $(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD) clean: $(CC) clean -x codeqa: misspell golint test generate: $(CC) generate gofmt: gofmt -w pkg/ cmd/ golint: $(GOPATH)/bin/golint . misspell: $(GOPATH)/bin/misspell pkg/* cmd/* Makefile README.md test: ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH)) ifeq ($(shell go env GOOS), $(shell go env GOHOSTOS)) $(CC) test ./... else $(info skipping tests of other platforms) endif else $(info skipping tests of other platforms) endif .PHONY: setup release release-vendor vendor build clean codeqa generate gofmt golint misspell test