This repository has been archived by the owner on Apr 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gotools.mk
41 lines (34 loc) · 1.66 KB
/
gotools.mk
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
# Copyright IBM Corp All Rights Reserved.
# Copyright London Stock Exchange Group All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
GOTOOLS = counterfeiter ginkgo gocov gocov-xml goimports golint misspell mockery protoc-gen-go
BUILD_DIR ?= build
GOTOOLS_BINDIR ?= $(shell go env GOPATH)/bin
# go tool->path mapping
go.fqp.counterfeiter := github.com/maxbrunsfeld/counterfeiter/v6
go.fqp.ginkgo := github.com/onsi/ginkgo/ginkgo
go.fqp.gocov := github.com/axw/gocov/gocov
go.fqp.gocov-xml := github.com/AlekSi/gocov-xml
go.fqp.goimports := golang.org/x/tools/cmd/goimports
go.fqp.golint := golang.org/x/lint/golint
go.fqp.manifest-tool := github.com/estesp/manifest-tool
go.fqp.misspell := github.com/client9/misspell/cmd/misspell
go.fqp.mockery := github.com/vektra/mockery/cmd/mockery
go.fqp.protoc-gen-go := github.com/golang/protobuf/protoc-gen-go
.PHONY: gotools-install
gotools-install: $(patsubst %,$(GOTOOLS_BINDIR)/%, $(GOTOOLS))
.PHONY: gotools-clean
gotools-clean:
# Default rule for gotools uses the name->path map for a generic 'go get' style build
gotool.mockery:
@echo "Building github.com/vektra/mockery/cmd/mockery -> mockery"
GOPATH=$(abspath $(GOTOOLS_GOPATH)) GOBIN=$(abspath $(GOTOOLS_BINDIR)) go get github.com/vektra/mockery/cmd/mockery
# Default rule for gotools uses the name->path map for a generic 'go get' style build
gotool.%:
$(eval TOOL = ${subst gotool.,,${@}})
@echo "Building ${go.fqp.${TOOL}} -> $(TOOL)"
@cd tools && GO111MODULE=on GOBIN=$(abspath $(GOTOOLS_BINDIR)) go install ${go.fqp.${TOOL}}
$(GOTOOLS_BINDIR)/%:
$(eval TOOL = ${subst $(GOTOOLS_BINDIR)/,,${@}})
@$(MAKE) -f gotools.mk gotool.$(TOOL)