diff --git a/Makefile b/Makefile index 4d47d9318..d40dbd8f8 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,15 @@ BINDIR := $(CURDIR)/bin BINARIES := helm tiller HOSTARCH := $(shell $(GO) env GOHOSTARCH) HOSTOS := $(shell $(GO) env GOHOSTOS) -BUILDARCH := $${GOARCH:-$(HOSTARCH)} -BUILDOS := $${GOOS:-$(HOSTOS)} +BUILDARCH := $(shell echo $${GOARCH:-$(HOSTARCH)}) +BUILDOS := $(shell echo $${GOOS:-$(HOSTOS)}) +GOBIN := $(BINDIR) +ifneq ($(BUILDARCH),$(HOSTARCH)) + GOBIN := +endif +ifneq ($(BUILDOS),$(HOSTOS)) + GOBIN := +endif .PHONY: all all: build @@ -25,18 +32,14 @@ build: gobuild copy .PHONY: 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 copy: - @if [ $(BUILDARCH) != $(HOSTARCH) ] || [ $(BUILDOS) != $(HOSTOS) ]; then \ + @if [ "$(BINDIR)" != "$(GOBIN)" ]; then \ for binary in ${BINARIES} ; do \ cp $(GOPATH)/bin/$(BUILDOS)_$(BUILDARCH)/$$binary $(BINDIR); \ done \ - else \ - for binary in ${BINARIES} ; do \ - cp $(GOPATH)/bin/$$binary $(BINDIR); \ - done \ fi .PHONY: check-docker