Skip to content

Commit 794e44b

Browse files
author
sapcc-bot
committed
Run go-makefile-maker
1 parent 104dea5 commit 794e44b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

9+
# macOS ships with make 3.81 from 2006, which does not support all the features that we want (e.g. --warn-undefined-variables)
10+
ifeq ($(MAKE_VERSION),3.81)
11+
ifeq (,$(shell which gmake 2>/dev/null))
12+
$(error We do not support this "make" version ($(MAKE_VERSION)) which is two decades old. Please install a newer version, e.g. using "brew install make")
13+
else
14+
$(error We do not support this "make" version ($(MAKE_VERSION)) which is two decades old. You have a newer GNU make installed, so please run "gmake" instead)
15+
endif
16+
endif
17+
918
MAKEFLAGS=--warn-undefined-variables
1019
# /bin/sh is dash on Debian which does not support all features of ash/bash
1120
# to fix that we use /bin/bash only on Debian to not break Alpine
@@ -34,7 +43,7 @@ install-modernize: FORCE
3443
@if ! hash modernize 2>/dev/null; then printf "\e[1;36m>> Installing modernize (this may take a while)...\e[0m\n"; go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest; fi
3544

3645
install-shellcheck: FORCE
37-
@if ! hash shellcheck 2>/dev/null; then printf "\e[1;36m>> Installing shellcheck...\e[0m\n"; SHELLCHECK_ARCH=$(shell uname -m); SHELLCHECK_OS=$(shell uname -s | tr '[:upper:]' '[:lower:]'); if [[ "$$SHELLCHECK_OS" == "darwin" ]]; then SHELLCHECK_OS=macos; fi; SHELLCHECK_VERSION="stable"; if command -v curl >/dev/null 2>&1; then GET="curl -sLo-"; elif command -v wget >/dev/null 2>&1; then GET="wget -O-"; else echo "Didn't find curl or wget to download shellcheck"; exit 2; fi; $$GET "https://github.com/koalaman/shellcheck/releases/download/$$SHELLCHECK_VERSION/shellcheck-$$SHELLCHECK_VERSION.$$SHELLCHECK_OS.$$SHELLCHECK_ARCH.tar.xz" | tar -Jxf -; BIN=$$(go env GOBIN); if [[ -z $$BIN ]]; then BIN=$$(go env GOPATH)/bin; fi; install -Dm755 shellcheck-$$SHELLCHECK_VERSION/shellcheck -t "$$BIN"; rm -rf shellcheck-$$SHELLCHECK_VERSION; fi
46+
@if ! hash shellcheck 2>/dev/null; then printf "\e[1;36m>> Installing shellcheck...\e[0m\n"; SHELLCHECK_ARCH=$(shell uname -m); if [[ "$$SHELLCHECK_ARCH" == "arm64" ]]; then SHELLCHECK_ARCH=aarch64; fi; SHELLCHECK_OS=$(shell uname -s | tr '[:upper:]' '[:lower:]'); SHELLCHECK_VERSION="stable"; if command -v curl >/dev/null 2>&1; then GET="curl -sLo-"; elif command -v wget >/dev/null 2>&1; then GET="wget -O-"; else echo "Didn't find curl or wget to download shellcheck"; exit 2; fi; $$GET "https://github.com/koalaman/shellcheck/releases/download/$$SHELLCHECK_VERSION/shellcheck-$$SHELLCHECK_VERSION.$$SHELLCHECK_OS.$$SHELLCHECK_ARCH.tar.xz" | tar -Jxf -; BIN=$$(go env GOBIN); if [[ -z $$BIN ]]; then BIN=$$(go env GOPATH)/bin; fi; install -Dm755 shellcheck-$$SHELLCHECK_VERSION/shellcheck -t "$$BIN"; rm -rf shellcheck-$$SHELLCHECK_VERSION; fi
3847

3948
install-go-licence-detector: FORCE
4049
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector (this may take a while)...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
@@ -53,7 +62,7 @@ install-controller-gen: FORCE
5362
install-setup-envtest: FORCE
5463
@if ! hash setup-envtest 2>/dev/null; then printf "\e[1;36m>> Installing setup-envtest (this may take a while)...\e[0m\n"; go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest; fi
5564

56-
# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.
65+
# To add additional flags or values (before the default ones), specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.
5766
# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.
5867
GO_BUILDFLAGS +=
5968
GO_LDFLAGS +=
@@ -174,6 +183,7 @@ vars: FORCE
174183
@printf "GO_TESTFLAGS=$(GO_TESTFLAGS)\n"
175184
@printf "GO_TESTPKGS=$(GO_TESTPKGS)\n"
176185
@printf "MAKE=$(MAKE)\n"
186+
@printf "MAKE_VERSION=$(MAKE_VERSION)\n"
177187
@printf "PREFIX=$(PREFIX)\n"
178188
@printf "SED=$(SED)\n"
179189
@printf "UNAME_S=$(UNAME_S)\n"

0 commit comments

Comments
 (0)