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-08-12 22:46:22 +00:00
# Bump these on release
2016-09-07 23:44:01 +00:00
VERSION_MAJOR ?= 0
2017-01-10 18:42:06 +00:00
VERSION_MINOR ?= 15
2016-12-14 19:38:12 +00:00
VERSION_BUILD ?= 0
2016-09-07 23:44:01 +00:00
VERSION ?= v$( VERSION_MAJOR) .$( VERSION_MINOR) .$( VERSION_BUILD)
DEB_VERSION ?= $( VERSION_MAJOR) .$( VERSION_MINOR) -$( VERSION_BUILD)
INSTALL_SIZE ?= $( shell du out/minikube-windows-amd64.exe | cut -f1)
2016-11-03 21:22:44 +00:00
BUILDROOT_BRANCH ?= 2016.08
2016-05-28 19:41:45 +00:00
2016-05-04 21:29:13 +00:00
GOOS ?= $( shell go env GOOS)
GOARCH ?= $( shell go env GOARCH)
BUILD_DIR ?= ./out
2016-07-14 18:36:05 +00:00
ORG := k8s.io
REPOPATH ?= $( ORG) /minikube
2016-09-23 16:09:15 +00:00
BUILD_IMAGE ?= gcr.io/google_containers/kube-cross:v1.7.1-0
2016-09-14 21:01:33 +00:00
IS_EXE ?=
2016-05-14 17:27:58 +00:00
i f e q ( $( IN_DOCKER ) , 1 )
GOPATH := /go
e l s e
2016-05-24 17:25:09 +00:00
GOPATH := $( shell pwd ) /_gopath
2016-05-14 17:27:58 +00:00
e n d i f
2016-10-29 16:54:48 +00:00
export GOPATH
2016-05-27 04:58:12 +00:00
# Use system python if it exists, otherwise use Docker.
2016-06-23 17:50:09 +00:00
PYTHON := $( shell command -v python || echo " docker run --rm -it -v $( shell pwd ) :/minikube -w /minikube python python " )
2016-05-30 17:50:06 +00:00
BUILD_OS := $( shell uname -s)
2016-05-28 19:41:45 +00:00
2016-11-29 19:55:49 +00:00
LOCALKUBE_VERSION := $( shell $( PYTHON) hack/get_k8s_version.py --k8s-version-only 2>& 1)
LOCALKUBE_BUCKET := gs://minikube/k8sReleases
2016-05-25 20:23:12 +00:00
# Set the version information for the Kubernetes servers, and build localkube statically
2016-05-28 14:50:36 +00:00
K8S_VERSION_LDFLAGS := $( shell $( PYTHON) hack/get_k8s_version.py 2>& 1)
2016-07-14 16:22:19 +00:00
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version= $( VERSION)
2016-05-28 14:50:36 +00:00
LOCALKUBE_LDFLAGS := " $( K8S_VERSION_LDFLAGS) $( MINIKUBE_LDFLAGS) -s -w -extldflags '-static' "
2016-05-15 16:17:42 +00:00
2016-10-29 16:54:48 +00:00
LOCALKUBEFILES := GOPATH = $( GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/localkube/ | grep k8s.io | GOPATH = $( GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
MINIKUBEFILES := GOPATH = $( GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/minikube/ | grep k8s.io | GOPATH = $( GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
2016-05-04 21:29:13 +00:00
2016-09-14 21:01:33 +00:00
i f e q ( $( GOOS ) , w i n d o w s )
IS_EXE = ".exe"
e n d i f
out/minikube$(IS_EXE) : out /minikube -$( GOOS ) -$( GOARCH ) $( IS_EXE )
cp $( BUILD_DIR) /minikube-$( GOOS) -$( GOARCH) $( IS_EXE) $( BUILD_DIR) /minikube$( IS_EXE)
2016-05-04 21:29:13 +00:00
2016-10-04 14:25:18 +00:00
out/localkube : $( GOPATH ) /src /$( ORG ) $( shell $ ( LOCALKUBEFILES ) )
2016-05-30 17:50:06 +00:00
i f e q ( $( BUILD_OS ) , L i n u x )
2016-05-28 14:50:36 +00:00
CGO_ENABLED = 1 go build -ldflags= $( LOCALKUBE_LDFLAGS) -o $( BUILD_DIR) /localkube ./cmd/localkube
2016-05-12 18:44:32 +00:00
e l s e
2016-05-25 20:23:12 +00:00
docker run -w /go/src/$( REPOPATH) -e IN_DOCKER = 1 -v $( shell pwd ) :/go/src/$( REPOPATH) $( BUILD_IMAGE) make out/localkube
2016-05-12 18:44:32 +00:00
e n d i f
2016-05-04 21:29:13 +00:00
2016-09-29 00:35:42 +00:00
out/minikube-darwin-amd64 : $( GOPATH ) /src /$( ORG ) pkg /minikube /assets /assets .go $( shell $ ( MINIKUBEFILES ) )
2017-01-09 20:51:30 +00:00
CGO_ENABLED = 0 GOARCH = amd64 GOOS = darwin go build --installsuffix cgo -ldflags= " $( MINIKUBE_LDFLAGS) $( K8S_VERSION_LDFLAGS) " -a -o $( BUILD_DIR) /minikube-darwin-amd64 k8s.io/minikube/cmd/minikube
2016-07-15 19:59:48 +00:00
2016-09-29 00:35:42 +00:00
out/minikube-linux-amd64 : $( GOPATH ) /src /$( ORG ) pkg /minikube /assets /assets .go $( shell $ ( MINIKUBEFILES ) )
2017-01-09 20:51:30 +00:00
CGO_ENABLED = 0 GOARCH = amd64 GOOS = linux go build --installsuffix cgo -ldflags= " $( MINIKUBE_LDFLAGS) $( K8S_VERSION_LDFLAGS) " -a -o $( BUILD_DIR) /minikube-linux-amd64 k8s.io/minikube/cmd/minikube
2016-07-15 19:59:48 +00:00
2016-09-29 00:35:42 +00:00
out/minikube-windows-amd64.exe : $( GOPATH ) /src /$( ORG ) pkg /minikube /assets /assets .go $( shell $ ( MINIKUBEFILES ) )
2017-01-09 20:51:30 +00:00
CGO_ENABLED = 0 GOARCH = amd64 GOOS = windows go build --installsuffix cgo -ldflags= " $( MINIKUBE_LDFLAGS) $( K8S_VERSION_LDFLAGS) " -a -o $( BUILD_DIR) /minikube-windows-amd64.exe k8s.io/minikube/cmd/minikube
2016-05-04 21:29:13 +00:00
2016-05-27 21:42:42 +00:00
localkube-image : out /localkube
make -C deploy/docker VERSION = $( VERSION)
iso :
2016-10-13 12:06:31 +00:00
cd deploy/iso/boot2docker && ./build.sh
minikube-iso :
2016-11-03 21:22:44 +00:00
if [ ! -d $( BUILD_DIR) /buildroot ] ; then \
mkdir -p $( BUILD_DIR) ; \
git clone --branch= $( BUILDROOT_BRANCH) https://github.com/buildroot/buildroot $( BUILD_DIR) /buildroot; \
fi ;
$( MAKE) BR2_EXTERNAL = ../../deploy/iso/minikube-iso minikube_defconfig -C $( BUILD_DIR) /buildroot
$( MAKE) -C $( BUILD_DIR) /buildroot
2016-05-27 21:42:42 +00:00
2016-05-04 22:29:50 +00:00
.PHONY : integration
2016-05-12 18:44:32 +00:00
integration : out /minikube
2016-11-02 19:59:55 +00:00
go test -v -test.timeout= 30m $( REPOPATH) /test/integration --tags= integration --minikube-args= " $( MINIKUBE_ARGS) "
2016-05-04 21:29:13 +00:00
.PHONY : test
2016-09-29 00:35:42 +00:00
test : $( GOPATH ) /src /$( ORG ) pkg /minikube /assets /assets .go
2016-05-04 22:29:50 +00:00
./test.sh
2016-05-12 17:09:58 +00:00
2016-10-21 00:30:18 +00:00
pkg/minikube/assets/assets.go : out /localkube $( GOPATH ) /bin /go -bindata deploy /addons
2016-12-07 18:49:03 +00:00
$( GOPATH) /bin/go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets ./out/localkube deploy/addons/...
2016-05-13 15:35:30 +00:00
2016-10-04 14:25:18 +00:00
$(GOPATH)/bin/go-bindata : $( GOPATH ) /src /$( ORG )
2016-07-07 20:07:00 +00:00
GOBIN = $( GOPATH) /bin go get github.com/jteeuwen/go-bindata/...
2016-07-04 10:10:44 +00:00
2016-07-08 16:23:03 +00:00
.PHONY : cross
2016-07-22 11:23:13 +00:00
cross : out /localkube out /minikube -linux -amd 64 out /minikube -darwin -amd 64 out /minikube -windows -amd 64.exe
2016-07-08 16:23:03 +00:00
2016-07-22 11:23:57 +00:00
.PHONE : checksum
checksum :
for f in out/localkube out/minikube-linux-amd64 out/minikube-darwin-amd64 out/minikube-windows-amd64.exe ; do \
if [ -f " $$ {f} " ] ; then \
openssl sha256 " $$ {f} " | awk '{print $$2}' > " $$ {f}.sha256 " ; \
fi ; \
done
2016-07-07 18:29:31 +00:00
.PHONY : clean
2016-07-04 10:10:44 +00:00
clean :
rm -rf $( GOPATH)
rm -rf $( BUILD_DIR)
2016-09-29 00:35:42 +00:00
rm -f pkg/minikube/assets/assets.go
2016-07-08 16:38:23 +00:00
.PHONY : gendocs
gendocs : docs /minikube .md
2016-09-29 00:35:42 +00:00
docs/minikube.md : $( GOPATH ) /src /$( ORG ) $( shell find cmd ) $( shell find pkg /minikube /constants ) pkg /minikube /assets /assets .go
2016-07-27 15:38:16 +00:00
cd $( GOPATH) /src/$( REPOPATH) && go run -ldflags= " $( K8S_VERSION_LDFLAGS) $( MINIKUBE_LDFLAGS) " -tags gendocs gen_help_text.go
2016-08-12 22:46:22 +00:00
out/minikube_$(DEB_VERSION).deb : out /minikube -linux -amd 64
cp -r installers/linux/deb/minikube_deb_template out/minikube_$( DEB_VERSION)
chmod 0755 out/minikube_$( DEB_VERSION) /DEBIAN
sed -E -i 's/--VERSION--/' $( DEB_VERSION) '/g' out/minikube_$( DEB_VERSION) /DEBIAN/control
2016-10-05 17:29:27 +00:00
mkdir -p out/minikube_$( DEB_VERSION) /usr/bin
2016-11-17 12:55:29 +00:00
cp out/minikube-linux-amd64 out/minikube_$( DEB_VERSION) /usr/bin/minikube
2016-08-12 22:46:22 +00:00
dpkg-deb --build out/minikube_$( DEB_VERSION)
rm -rf out/minikube_$( DEB_VERSION)
2016-09-07 23:44:01 +00:00
out/minikube-installer.exe : out /minikube -windows -amd 64.exe
rm -rf out/windows_tmp
cp -r installers/windows/ out/windows_tmp
cp -r LICENSE out/windows_tmp/LICENSE
awk 'sub("$$", "\r")' out/windows_tmp/LICENSE > out/windows_tmp/LICENSE.txt
sed -E -i 's/--VERSION_MAJOR--/' $( VERSION_MAJOR) '/g' out/windows_tmp/minikube.nsi
sed -E -i 's/--VERSION_MINOR--/' $( VERSION_MINOR) '/g' out/windows_tmp/minikube.nsi
sed -E -i 's/--VERSION_BUILD--/' $( VERSION_BUILD) '/g' out/windows_tmp/minikube.nsi
sed -E -i 's/--INSTALL_SIZE--/' $( INSTALL_SIZE) '/g' out/windows_tmp/minikube.nsi
cp out/minikube-windows-amd64.exe out/windows_tmp/minikube.exe
makensis out/windows_tmp/minikube.nsi
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe
rm -rf out/windows_tmp
2016-09-23 19:00:23 +00:00
2016-10-04 14:25:18 +00:00
.PHONY : gopath
gopath : $( GOPATH ) /src /$( ORG )
$(GOPATH)/src/$(ORG) :
mkdir -p $( GOPATH) /src/$( ORG)
ln -s -f $( shell pwd ) $( GOPATH) /src/$( ORG)
2016-09-23 19:00:23 +00:00
.PHONY : check -release
check-release :
go test -v ./deploy/minikube/release_sanity_test.go -tags= release
2016-11-29 19:55:49 +00:00
.PHONY : release -localkube
release-localkube : out /localkube checksum
gsutil cp out/localkube $( LOCALKUBE_BUCKET) /$( LOCALKUBE_VERSION) /localkube-linux-amd64
gsutil cp out/localkube.sha256 $( LOCALKUBE_BUCKET) /$( LOCALKUBE_VERSION) /localkube-linux-amd64.sha256
.PHONY : update -releases
update-releases :
gsutil cp deploy/minikube/k8s_releases.json gs://minikube/k8s_releases.json