Skip to content

Commit c1db092

Browse files
xcarolanmedyagh
authored andcommitted
Check if sed is GNU or BSD version.
1 parent 7ef0644 commit c1db092

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ BUILD_OS := $(shell uname -s)
106106

107107
SHA512SUM=$(shell command -v sha512sum || echo "shasum -a 512")
108108

109+
# check which "flavor" of SED is being used as the flags are different between BSD and GNU sed.
110+
# BSD sed does not support "--version"
111+
SED_VERSION := $(shell sed --version 2>/dev/null | head -n 1 | cut -d' ' -f4)
112+
ifeq ($(SED_VERSION),)
113+
SED = sed -i ''
114+
else
115+
SED = sed -i
116+
endif
117+
109118
# gvisor tag to automatically push changes to
110119
# to update minikubes default, update deploy/addons/gvisor
111120
GVISOR_TAG ?= v0.0.1
@@ -728,10 +737,6 @@ local-kicbase: ## Builds the kicbase image and tags it local/kicbase:latest and
728737
docker tag local/kicbase:$(KIC_VERSION) local/kicbase:latest
729738
docker tag local/kicbase:$(KIC_VERSION) local/kicbase:$(KIC_VERSION)-$(COMMIT_SHORT)
730739

731-
SED = sed -i
732-
ifeq ($(GOOS),darwin)
733-
SED = sed -i ''
734-
endif
735740

736741
.PHONY: local-kicbase-debug
737742
local-kicbase-debug: local-kicbase ## Builds a local kicbase image and switches source code to point to it

0 commit comments

Comments
 (0)