Joey Armstrong | fd0d200 | 2023-08-02 19:52:01 -0400 | [diff] [blame] | 1 | # -*- 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 | |
| 18 | MAKEDIR ?= $(error MAKEDIR= is required) |
| 19 | |
| 20 | ## ----------------------------------------------------------------------- |
| 21 | ## ----------------------------------------------------------------------- |
| 22 | help:: |
| 23 | @echo " kind Install the kind command" |
| 24 | ifdef VERBOSE |
| 25 | @echo " make kind KIND_PATH=" |
| 26 | endif |
| 27 | |
| 28 | kind-cmd-bin ?= kind-linux-amd64 |
| 29 | # kind-cmd-ver ?= v0.20.0 |
| 30 | kind-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 Armstrong | c1d94d5 | 2023-08-03 10:34:10 -0400 | [diff] [blame] | 39 | KIND_PATH ?= $(if $(WORKSPACE),$(WORKSPACE)/bin,$(PWD)/bin) |
| 40 | kind-cmd-link ?= $(KIND_PATH)/kind |
| 41 | kind-cmd ?= $(kind-cmd-link).$(kind-cmd-ver).$(kind-cmd-bin) |
Joey Armstrong | fd0d200 | 2023-08-02 19:52:01 -0400 | [diff] [blame] | 42 | $(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 Armstrong | c1d94d5 | 2023-08-03 10:34:10 -0400 | [diff] [blame] | 49 | $(kind-cmd-link) : $(kind-cmd) |
Joey Armstrong | fd0d200 | 2023-08-02 19:52:01 -0400 | [diff] [blame] | 50 | ln -fns $< $@ |
| 51 | |
| 52 | ## ----------------------------------------------------------------------- |
| 53 | ## ----------------------------------------------------------------------- |
| 54 | .PHONY: install-command-kind |
Joey Armstrong | c1d94d5 | 2023-08-03 10:34:10 -0400 | [diff] [blame] | 55 | install-command-kind : $(kind-cmd-link) |
Joey Armstrong | fd0d200 | 2023-08-02 19:52:01 -0400 | [diff] [blame] | 56 | |
| 57 | clean :: |
| 58 | $(RM) bin/kind $(kind-cmd) |
| 59 | |
| 60 | # [EOF] |