Makefile 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 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.

15 16 17 18 19
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
BUILD_DIR ?= ./out
GOPATH := $(shell pwd)/.gopath
REPOPATH ?= k8s.io/minikube
20
export GO15VENDOREXPERIMENT=1
21 22 23 24 25

clean:
	rm -rf $(GOPATH)
	rm -rf $(BUILD_DIR)

26
gopath:
27
	mkdir -p $(shell dirname $(GOPATH)/src/$(REPOPATH))
28
	ln -s -f $(shell pwd) $(GOPATH)/src/$(REPOPATH)
29 30 31 32 33 34 35 36 37 38

.PHONY: minikube
minikube: minikube-$(GOOS)-$(GOARCH)
	cp $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/minikube

.PHONY: localkube
localkube: localkube-$(GOOS)-$(GOARCH)
	cp $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/localkube

minikube-$(GOOS)-$(GOARCH): gopath
39
	CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build --installsuffix cgo -a -o $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) ./cmd/minikube
40 41

localkube-$(GOOS)-$(GOARCH): gopath
42
	GOARCH=$(GOARCH) GOOS=$(GOOS) go build -o $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) ./cmd/localkube
43

D
dlorenc 已提交
44
.PHONY: integration
45
integration: minikube
46
	go test -v ./test/integration --tags=integration
47

48 49 50 51 52 53
localkube-incremental:
	GOPATH=/go CGO_ENABLED=1 GOBIN=$(shell pwd)/$(BUILD_DIR) go install ./cmd/localkube

docker/localkube:
	docker run -w /go/src/k8s.io/minikube -v $(shell pwd):/go/src/k8s.io/minikube golang:1.6 make localkube-incremental

54 55
.PHONY: test
test: gopath
D
dlorenc 已提交
56
	./test.sh