51 lines
1.1 KiB
Makefile
51 lines
1.1 KiB
Makefile
CC=go
|
|
BUILD=build -v -trimpath
|
|
VERSION=$(shell cat VERSION)
|
|
GCFLAGS=-gcflags 'all=-e'
|
|
LDFLAGS=-ldflags '-X main.version=$(VERSION) -s -w'
|
|
PROGRAM=docstore
|
|
ENV=CGO_ENABLED=0 GO111MODULE=on
|
|
|
|
all: $(PROGRAM)
|
|
|
|
setup:
|
|
$(CC) get github.com/client9/misspell
|
|
|
|
release: clean gofmt codeqa
|
|
$(ENV) $(CC) $(BUILD) $(LDFLAGS)
|
|
|
|
release-vendor: clean gofmt codeqa
|
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
|
|
|
vendor: clean gofmt
|
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
|
|
|
$(PROGRAM): clean gofmt
|
|
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS)
|
|
|
|
clean:
|
|
$(CC) clean -x
|
|
|
|
codeqa: misspell golint test
|
|
|
|
gofmt:
|
|
gofmt -w pkg/ main.go
|
|
|
|
golint:
|
|
$(GOPATH)/bin/golint .
|
|
|
|
misspell:
|
|
$(GOPATH)/bin/misspell pkg/* templates/* main.go Makefile README.md sri.sh templates.sh
|
|
|
|
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 gofmt golint misspell test
|