Update Makefile.COMMON from prometheus/utils

This commit is contained in:
Steve Durrheimer 2015-06-07 14:36:12 +02:00
parent 5558fb0ffc
commit ab7826fb39

View file

@ -49,19 +49,22 @@ ifeq ($(GOOS),darwin)
endif endif
GO_VERSION ?= 1.4.2 GO_VERSION ?= 1.4.2
ifeq ($(shell type go >/dev/null && go version | sed 's/.*go\([0-9.]*\).*/\1/'), $(GO_VERSION))
GOROOT := $(shell go env GOROOT)
else
GOROOT := $(CURDIR)/.build/go$(GO_VERSION)
endif
GOURL ?= https://golang.org/dl GOURL ?= https://golang.org/dl
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz
GOPATH := $(CURDIR)/.build/gopath GOPATH := $(CURDIR)/.build/gopath
GOCC ?= $(GOROOT)/bin/go
GO ?= GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC) # Check for the correct version of go in the path. If we find it, use it.
GOFMT ?= $(GOROOT)/bin/gofmt # Otherwise, prepare to build go locally.
ifeq ($(shell command -v "go" >/dev/null && go version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/'), $(GO_VERSION))
GOCC ?= $(shell command -v "go")
GOFMT ?= $(shell command -v "gofmt")
GO ?= GOPATH=$(GOPATH) $(GOCC)
else
GOROOT ?= $(CURDIR)/.build/go$(GO_VERSION)
GOCC ?= $(GOROOT)/bin/go
GOFMT ?= $(GOROOT)/bin/gofmt
GO ?= GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
endif
# Never honor GOBIN, should it be set at all. # Never honor GOBIN, should it be set at all.
unexport GOBIN unexport GOBIN