github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/gotools/Makefile (about) 1 # Copyright London Stock Exchange Group All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 BINDIR ?= /usr/local/bin 16 OBJDIR ?= build 17 18 TMP_GOPATH=$(OBJDIR)/gopath 19 GOBIN=$(abspath $(TMP_GOPATH)/bin) 20 21 GOTOOLS = golint govendor goimports protoc-gen-go ginkgo gocov gocov-xml misspell 22 GOTOOLS_BIN = $(patsubst %,$(GOBIN)/%, $(GOTOOLS)) 23 24 # go tool->path mapping 25 go.fqp.govendor := github.com/kardianos/govendor 26 go.fqp.golint := github.com/golang/lint/golint 27 go.fqp.goimports := golang.org/x/tools/cmd/goimports 28 go.fqp.ginkgo := github.com/onsi/ginkgo/ginkgo 29 go.fqp.gocov := github.com/axw/gocov/... 30 go.fqp.misspell := github.com/client9/misspell/cmd/misspell 31 go.fqp.gocov-xml:= github.com/AlekSi/gocov-xml 32 all: $(GOTOOLS_BIN) 33 34 install: $(GOTOOLS_BIN) 35 @mkdir -p $(BINDIR) 36 cp $^ $(BINDIR) 37 38 # Special override for protoc-gen-go since we want to use the version vendored with the project 39 gotool.protoc-gen-go: 40 @echo "Building github.com/golang/protobuf/protoc-gen-go -> protoc-gen-go" 41 @mkdir -p $(TMP_GOPATH)/src/github.com/golang/protobuf/ 42 @cp -R $(GOPATH)/src/github.com/hyperledger/fabric/vendor/github.com/golang/protobuf/* $(TMP_GOPATH)/src/github.com/golang/protobuf 43 @GOPATH=$(abspath $(TMP_GOPATH)) go install github.com/golang/protobuf/protoc-gen-go 44 45 # Default rule for gotools uses the name->path map for a generic 'go get' style build 46 gotool.%: 47 $(eval TOOL = ${subst gotool.,,${@}}) 48 @echo "Building ${go.fqp.${TOOL}} -> $(TOOL)" 49 @GOPATH=$(abspath $(TMP_GOPATH)) go get ${go.fqp.${TOOL}} 50 51 $(GOBIN)/%: 52 $(eval TOOL = ${subst $(GOBIN)/,,${@}}) 53 @$(MAKE) gotool.$(TOOL) 54 55 .PHONY: clean 56 clean: 57 -@rm -rf $(OBJDIR)