Allow overrides for GO and PROMU

This allows the user to override how/where promu and/or go is invoked.
This commit is contained in:
Christian Svensson 2016-08-03 21:23:02 +02:00 committed by Christian Svensson
parent 296d7fdd2e
commit ee1a0cc3cc

View file

@ -11,8 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
GO := GO15VENDOREXPERIMENT=1 go GO ?= GO15VENDOREXPERIMENT=1 go
PROMU := $(GOPATH)/bin/promu PROMU ?= $(GOPATH)/bin/promu
pkgs = $(shell $(GO) list ./... | grep -v /vendor/) pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
PREFIX ?= $(shell pwd) PREFIX ?= $(shell pwd)
@ -43,11 +43,11 @@ vet:
@echo ">> vetting code" @echo ">> vetting code"
@$(GO) vet $(pkgs) @$(GO) vet $(pkgs)
build: promu build: $(PROMU)
@echo ">> building binaries" @echo ">> building binaries"
@$(PROMU) build --prefix $(PREFIX) @$(PROMU) build --prefix $(PREFIX)
tarball: promu tarball: $(PROMU)
@echo ">> building release tarball" @echo ">> building release tarball"
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) @$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
@ -55,10 +55,10 @@ docker:
@echo ">> building docker image" @echo ">> building docker image"
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
promu: $(GOPATH)/bin/promu promu:
@GOOS=$(shell uname -s | tr A-Z a-z) \ @GOOS=$(shell uname -s | tr A-Z a-z) \
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
$(GO) get -u github.com/prometheus/promu $(GO) get -u github.com/prometheus/promu
.PHONY: all style format build test test-e2e vet tarball docker promu .PHONY: all style format build test test-e2e vet tarball docker promu $(GOPATH)/bin/promu