2016-05-05 13:38:23 +00:00
|
|
|
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2016-05-04 21:29:13 +00:00
|
|
|
GOOS ?= $(shell go env GOOS)
|
|
|
|
GOARCH ?= $(shell go env GOARCH)
|
|
|
|
BUILD_DIR ?= ./out
|
2016-05-14 17:27:58 +00:00
|
|
|
|
|
|
|
ifeq ($(IN_DOCKER),1)
|
|
|
|
GOPATH := /go
|
|
|
|
else
|
|
|
|
GOPATH := $(shell pwd)/.gopath
|
|
|
|
endif
|
|
|
|
|
2016-05-04 21:29:13 +00:00
|
|
|
REPOPATH ?= k8s.io/minikube
|
2016-05-05 13:38:23 +00:00
|
|
|
export GO15VENDOREXPERIMENT=1
|
2016-05-04 21:29:13 +00:00
|
|
|
|
2016-05-15 16:17:42 +00:00
|
|
|
# Set the version information in kubernetes.
|
2016-05-15 20:03:59 +00:00
|
|
|
LD_FLAGS = "-s -w $(shell python hack/get_k8s_version.py)"
|
2016-05-15 16:17:42 +00:00
|
|
|
|
2016-05-04 21:29:13 +00:00
|
|
|
clean:
|
|
|
|
rm -rf $(GOPATH)
|
|
|
|
rm -rf $(BUILD_DIR)
|
2016-05-18 22:44:13 +00:00
|
|
|
rm pkg/minikube/cluster/localkubecontents.go
|
2016-05-04 21:29:13 +00:00
|
|
|
|
2016-05-18 02:02:32 +00:00
|
|
|
MKGOPATH := mkdir -p $(shell dirname $(GOPATH)/src/$(REPOPATH)) && ln -s -f $(shell pwd) $(GOPATH)/src/$(REPOPATH)
|
|
|
|
LOCALKUBEFILES := $(shell find pkg/localkube -name '*.go') $(shell find cmd/localkube -name '*.go') $(shell find vendor -name '*.go')
|
|
|
|
MINIKUBEFILES := $(shell find pkg/minikube -name '*.go') $(shell find cmd/minikube -name '*.go') $(shell find vendor -name '*.go')
|
2016-05-04 21:29:13 +00:00
|
|
|
|
2016-05-12 18:44:32 +00:00
|
|
|
out/minikube: out/minikube-$(GOOS)-$(GOARCH)
|
2016-05-04 21:29:13 +00:00
|
|
|
cp $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/minikube
|
|
|
|
|
2016-05-18 02:02:32 +00:00
|
|
|
out/localkube: $(LOCALKUBEFILES)
|
|
|
|
$(MKGOPATH)
|
2016-05-12 18:44:32 +00:00
|
|
|
ifeq ($(GOOS),linux)
|
2016-05-15 16:17:42 +00:00
|
|
|
CGO_ENABLED=1 go build -ldflags=$(LD_FLAGS) -o $(BUILD_DIR)/localkube ./cmd/localkube
|
2016-05-12 18:44:32 +00:00
|
|
|
else
|
2016-05-15 16:17:42 +00:00
|
|
|
docker run -w /go/src/$(REPOPATH) -e IN_DOCKER=1 -v $(shell pwd):/go/src/$(REPOPATH) golang:1.6 make out/localkube
|
2016-05-12 18:44:32 +00:00
|
|
|
endif
|
2016-05-04 21:29:13 +00:00
|
|
|
|
2016-05-18 02:02:32 +00:00
|
|
|
out/minikube-$(GOOS)-$(GOARCH): $(MINIKUBEFILES) pkg/minikube/cluster/localkubecontents.go
|
|
|
|
$(MKGOPATH)
|
2016-05-05 13:38:23 +00:00
|
|
|
CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build --installsuffix cgo -a -o $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) ./cmd/minikube
|
2016-05-04 21:29:13 +00:00
|
|
|
|
2016-05-04 22:29:50 +00:00
|
|
|
.PHONY: integration
|
2016-05-12 18:44:32 +00:00
|
|
|
integration: out/minikube
|
2016-05-05 13:38:23 +00:00
|
|
|
go test -v ./test/integration --tags=integration
|
2016-05-04 21:29:13 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
2016-05-18 02:02:32 +00:00
|
|
|
test: pkg/minikube/cluster/localkubecontents.go
|
|
|
|
$(MKGOPATH)
|
2016-05-04 22:29:50 +00:00
|
|
|
./test.sh
|
2016-05-12 17:09:58 +00:00
|
|
|
|
2016-05-13 15:49:21 +00:00
|
|
|
pkg/minikube/cluster/localkubecontents.go: out/localkube $(GOPATH)/bin/go-bindata
|
2016-05-13 15:35:30 +00:00
|
|
|
$(GOPATH)/bin/go-bindata -nomemcopy -o pkg/minikube/cluster/localkubecontents.go -pkg cluster ./out/localkube
|
|
|
|
|
2016-05-18 02:02:32 +00:00
|
|
|
$(GOPATH)/bin/go-bindata:
|
|
|
|
$(MKGOPATH)
|
2016-05-13 15:49:21 +00:00
|
|
|
go get github.com/jteeuwen/go-bindata/...
|