blob: 81c68b1b8e47f4b71c38277dd13790d5695b0877 [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# -----------------------------------------------------------------------
Joey Armstrongc1d94d52023-08-03 10:34:10 -040039KIND_PATH ?= $(if $(WORKSPACE),$(WORKSPACE)/bin,$(PWD)/bin)
40kind-cmd-link ?= $(KIND_PATH)/kind
41kind-cmd ?= $(kind-cmd-link).$(kind-cmd-ver).$(kind-cmd-bin)
Joey Armstrongfd0d2002023-08-02 19:52:01 -040042$(kind-cmd):
43 @echo "kind-cmd = $(kind-cmd)"
44 mkdir -p $(dir $(kind-cmd))
45 curl --silent -Lo "$@" https://kind.sigs.k8s.io/dl/$(kind-cmd-ver)/$(kind-cmd-bin)
46 chmod +x "$@"
47 "$@" --version
48
Joey Armstrongc1d94d52023-08-03 10:34:10 -040049$(kind-cmd-link) : $(kind-cmd)
Joey Armstrongfd0d2002023-08-02 19:52:01 -040050 ln -fns $< $@
51
52## -----------------------------------------------------------------------
53## -----------------------------------------------------------------------
54.PHONY: install-command-kind
Joey Armstrongc1d94d52023-08-03 10:34:10 -040055install-command-kind : $(kind-cmd-link)
Joey Armstrongfd0d2002023-08-02 19:52:01 -040056
57clean ::
58 $(RM) bin/kind $(kind-cmd)
59
60# [EOF]