blob: a33634fd319fc8cd6e3e443dd6102b5b23e1ae76 (
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
39
40
41
42
43
44
45
|
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)
ifneq (v$(VERSION),$(LAST_TAG))
VERSION := $(shell echo $(VERSION)~beta.$(COMMITS).g$(REVISION))
endif
VERSION_FLAGS := -ldflags='-X "main.VERSION=$(VERSION)" -X "main.REVISION=$(REVISION)"'
# cd into the GOPATH to workaround ./... not following symlinks
_allpackages = $(shell ( cd $(CURDIR)/.GOPATH/src/$(IMPORT_PATH) && \
GOPATH=$(CURDIR)/.GOPATH go list ./... 2>&1 1>&3 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) 1>&2 ) 3>&1 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)))
_allfiles = $(shell cd $(CURDIR)/.GOPATH/src/$(IMPORT_PATH) && find . -iname '*.go' | grep -v "^\./\." | grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) )
# memoize allpackages, so that it's executed only once and only if used
allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)
allfiles = $(if $(__allfiles),,$(eval __allfiles := $$(_allfiles)))$(__allfiles)
export GOPATH := $(CURDIR)/.GOPATH
unexport GOBIN
Q := $(if $V,,@)
.GOPATH/.ok:
$Q mkdir -p "$(dir .GOPATH/src/$(IMPORT_PATH))"
$Q ln -s ../../../.. ".GOPATH/src/$(IMPORT_PATH)"
$Q mkdir -p .GOPATH/test .GOPATH/cover
$Q mkdir -p bin
$Q ln -s ../bin .GOPATH/bin
$Q touch $@
.PHONY: bin/gocovmerge bin/golangci-lint
bin/gocovmerge: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored gocovmerge not found, try running 'make setup'..."; exit 1; }
bin/golangci-lint: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored golangci-lint not found, try running 'make setup'..."; exit 1; }
|