blob: 435908371e025d662d24aa748c995b5a7ef5b03e [file] [log] [blame]
Joey Armstrongfd0d2002023-08-02 19:52:01 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17
18MAKEDIR ?= $(error MAKEDIR= is required)
19
20## -----------------------------------------------------------------------
21## -----------------------------------------------------------------------
22help::
23 @echo " kind Install the kind command"
24ifdef VERBOSE
25 @echo " make kind KIND_PATH="
26endif
27
28kind-cmd-bin ?= kind-linux-amd64
29# kind-cmd-ver ?= v0.20.0
30kind-cmd-ver ?= v0.11.0
31
32# -----------------------------------------------------------------------
33# Install the 'kind' tool if needed: https://github.com/boz/kind
34# o WORKSPACE - jenkins aware
35# o Default to /usr/local/bin/kind
36# + revisit this, system directories should not be a default path.
37# + requires sudo and potential exists for overwrite conflict.
38# -----------------------------------------------------------------------
39KIND_PATH ?= $(if $(WORKSPACE),$(WORKSPACE)/bin,$(PWD)/bin)
40kind-cmd ?= $(KIND_PATH)/kind.$(kind-cmd-ver).$(kind-cmd-bin)
41$(kind-cmd):
42 @echo "kind-cmd = $(kind-cmd)"
43 mkdir -p $(dir $(kind-cmd))
44 curl --silent -Lo "$@" https://kind.sigs.k8s.io/dl/$(kind-cmd-ver)/$(kind-cmd-bin)
45 chmod +x "$@"
46 "$@" --version
47
48bin/kind : $(kind-cmd)
49 ln -fns $< $@
50
51## -----------------------------------------------------------------------
52## -----------------------------------------------------------------------
53.PHONY: install-command-kind
54install-command-kind : bin/kind
55
56clean ::
57 $(RM) bin/kind $(kind-cmd)
58
59# [EOF]