blob: a3e7eb7bbeb39bfe2626447d4d8dbb6cc184e89a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
LAST_TAG := $(shell git describe --tags --abbrev=0)
COMMITS := $(shell echo `git log --oneline $(LAST_TAG)..HEAD | wc -l`)
VERSION := $(shell cat VERSION)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
ifneq (v$(VERSION),$(LAST_TAG))
VERSION := $(shell echo $(VERSION)~beta.$(COMMITS).g$(REVISION))
endif
VERSION_FLAGS :=-X "main.VERSION=$(VERSION)" -X "main.REVISION=$(REVISION)"
_allpackages = $(shell (go list ./... | \
grep -v $(addprefix -e ,$(IGNORED_DIRS))))
# memoize allpackages, so that it's executed only once and only if used
allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)
export GOPATH := $(CURDIR)/.GOPATH
export GOBIN := $(CURDIR)/bin
Q := $(if $V,,@)
.GOPATH/.ok:
mkdir -p .GOPATH
.PHONY: bin/golangci-lint
bin/golangci-lint: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored golangci-lint not found, try running 'make setup'..."; exit 1; }
bin/gotestsum: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored gotestsum not found, try running 'make setup'..."; exit 1; }
bin/mockgen: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored mockgen not found, try running 'make setup'..."; exit 1; }
|