From 3fd41d6f3c6eac0a3f2899f3db58fdfccd9e0b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 20 Jan 2018 15:42:34 +0100 Subject: [PATCH] Avoid the phony gopath make target Having a phony target as a minikube dependency means that it always needs to be rebuilt/copied, which is unnecessary. Also clean up and simplify the syntax, thereby avoiding the current copy/paste errors (that always come with duplication) --- Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 49732ae04..2cf1a3cfe 100755 --- a/Makefile +++ b/Makefile @@ -92,8 +92,8 @@ endif ifeq ($(GOOS),windows) IS_EXE = ".exe" endif -out/minikube$(IS_EXE): gopath out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE) - cp $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/minikube$(IS_EXE) +out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE) + cp $< $@ out/localkube: $(shell $(LOCALKUBEFILES)) ifeq ($(LOCALKUBE_BUILD_IN_DOCKER),y) @@ -109,6 +109,9 @@ out/minikube-%-amd64: pkg/minikube/assets/assets.go $(shell $(MINIKUBEFILES)) ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y) $(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@) else +ifneq ($(GOPATH)/src/$(REPOPATH),$(PWD)) + $(warning Warning: Building minikube outside the GOPATH, should be $(GOPATH)/src/$(REPOPATH) but is $(PWD)) +endif GOOS=$* go build -tags "$(MINIKUBE_BUILD_TAGS)" -ldflags="$(MINIKUBE_LDFLAGS) $(K8S_VERSION_LDFLAGS)" -a -o $@ k8s.io/minikube/cmd/minikube endif @@ -180,12 +183,6 @@ integration-versioned: out/minikube test: $(shell $(MINIKUBE_TEST_FILES)) pkg/minikube/assets/assets.go ./test.sh -.PHONY: gopath -gopath: -ifneq ($(GOPATH)/src/$(REPOPATH),$(PWD)) - $(warning Warning: Building minikube outside the GOPATH, should be $(GOPATH)/src/$(REPOPATH) but is $(PWD)) -endif - pkg/minikube/assets/assets.go: $(GOPATH)/bin/go-bindata $(shell find deploy/addons -type f) $(GOPATH)/bin/go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/... -- GitLab