don't pollute the default GOBIN root

pull/881/head
Marat G 9 years ago
parent 3dbfd5b7dd
commit 171da7fcc6

@ -14,8 +14,15 @@ BINDIR := $(CURDIR)/bin
BINARIES := helm tiller BINARIES := helm tiller
HOSTARCH := $(shell $(GO) env GOHOSTARCH) HOSTARCH := $(shell $(GO) env GOHOSTARCH)
HOSTOS := $(shell $(GO) env GOHOSTOS) HOSTOS := $(shell $(GO) env GOHOSTOS)
BUILDARCH := $${GOARCH:-$(HOSTARCH)} BUILDARCH := $(shell echo $${GOARCH:-$(HOSTARCH)})
BUILDOS := $${GOOS:-$(HOSTOS)} BUILDOS := $(shell echo $${GOOS:-$(HOSTOS)})
GOBIN := $(BINDIR)
ifneq ($(BUILDARCH),$(HOSTARCH))
GOBIN :=
endif
ifneq ($(BUILDOS),$(HOSTOS))
GOBIN :=
endif
.PHONY: all .PHONY: all
all: build all: build
@ -25,18 +32,14 @@ build: gobuild copy
.PHONY: gobuild .PHONY: gobuild
gobuild: gobuild:
$(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/... GOBIN=$(GOBIN) $(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/...
.PHONY: copy .PHONY: copy
copy: copy:
@if [ $(BUILDARCH) != $(HOSTARCH) ] || [ $(BUILDOS) != $(HOSTOS) ]; then \ @if [ "$(BINDIR)" != "$(GOBIN)" ]; then \
for binary in ${BINARIES} ; do \ for binary in ${BINARIES} ; do \
cp $(GOPATH)/bin/$(BUILDOS)_$(BUILDARCH)/$$binary $(BINDIR); \ cp $(GOPATH)/bin/$(BUILDOS)_$(BUILDARCH)/$$binary $(BINDIR); \
done \ done \
else \
for binary in ${BINARIES} ; do \
cp $(GOPATH)/bin/$$binary $(BINDIR); \
done \
fi fi
.PHONY: check-docker .PHONY: check-docker

Loading…
Cancel
Save