From 3134aa48501966f9398356f56fdecfab96ff9062 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt Date: Fri, 3 Mar 2017 23:36:25 -0400 Subject: [PATCH] Support offline build Don't reinstall promu if it is already available. --- Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0b26c36..10a6cbf 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO := GO15VENDOREXPERIMENT=1 go -PROMU := $(GOPATH)/bin/promu -pkgs = $(shell $(GO) list ./... | grep -v /vendor/) +GO := GO15VENDOREXPERIMENT=1 go +GOPATH := $(firstword $(subst :, ,$(GOPATH))) +PROMU ?= $(GOPATH)/bin/promu +pkgs = $(shell $(GO) list ./... | grep -v /vendor/) PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) @@ -39,11 +40,11 @@ vet: @echo ">> vetting code" @$(GO) vet $(pkgs) -build: promu +build: $(PROMU) @echo ">> building binaries" @$(PROMU) build --prefix $(PREFIX) -tarball: promu +tarball: $(PROMU) @echo ">> building release tarball" @$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) @@ -51,10 +52,7 @@ docker: @echo ">> building docker image" @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . -promu: - @GOOS=$(shell uname -s | tr A-Z a-z) \ - GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ - $(GO) get -u github.com/prometheus/promu - +$(PROMU) promu: + @GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu .PHONY: all style format build test vet tarball docker promu -- 2.25.1