@@ -10,6 +10,19 @@ BUILDDIR = build
1010GITDIR = $(shell git rev-parse --abbrev-ref HEAD)
1111STAGINGURL = http://192.241.195.202:9000/staging
1212
13+ # Platform and sed detection for cross-platform compatibility
14+ UNAME_S := $(shell uname -s)
15+ SED_IS_GNU := $(shell sed --version 2>/dev/null | grep -q "GNU sed" && echo "yes" || echo "no")
16+
17+ # Define the correct sed in-place command based on the system
18+ ifeq ($(SED_IS_GNU ) ,yes)
19+ SED_INPLACE := sed -i
20+ else ifeq ($(UNAME_S),Darwin)
21+ SED_INPLACE := sed -i''
22+ else
23+ SED_INPLACE := sed -i
24+ endif
25+
1326# Put it first so that "make" without argument is like "make help".
1427help :
1528 @$(SPHINXBUILD ) -M help " $( SOURCEDIR) " " $( BUILDDIR) " $(SPHINXOPTS ) $(O )
@@ -68,47 +81,24 @@ endif
6881 @echo -e "Building $@ Complete\n--------------------------------------\n"
6982
7083# Synchronization targets
71- # Note that the @case statements are required to account for differences between Linux and MacOS binaries
72- # Specifically, MacOS does not use GNU utils, so syntax is slightly different for things like sed
73- # Annoying but necessary
84+ # Cross-platform compatibility is handled by the SED_INPLACE variable defined at the top
7485
7586sync-operator-version :
7687 @echo " Retrieving latest Operator version"
7788 @$(eval OPERATOR = $(shell curl --retry 10 -Ls -o /dev/null -w "% {url_effective}" https://github.com/minio/operator/releases/latest | sed "s/https:\/\/github.com\/minio\/operator\/releases\/tag\///" | sed "s/v//") )
78- @$(eval kname = $(shell uname -s) )
7989 @$(eval K8SFLOOR = $(shell curl -sL https://raw.githubusercontent.com/minio/operator/master/testing/kind-config-floor.yaml | grep -F -m 1 'node:v' | awk 'BEGIN { FS = ":" } ; {print $$3}') )
8090
8191 @echo "Updating Operator to ${OPERATOR}"
82-
83- @$(eval kname = $(shell uname -s))
84-
85- @case "${kname}" in \
86- "Darwin") \
87- sed -i "" "s|OPERATOR|${OPERATOR}|g" source/conf.py;\
88- sed -i "" "s|K8SFLOOR|${K8SFLOOR}|g" source/conf.py; \
89- ;; \
90- *) \
91- sed -i "s|OPERATOR|${OPERATOR}|g" source/conf.py; \
92- sed -i "s|K8SFLOOR|${K8SFLOOR}|g" source/conf.py; \
93- ;; \
94- esac
92+ @$(SED_INPLACE) "s|OPERATOR|${OPERATOR}|g" source/conf.py
93+ @$(SED_INPLACE) "s|K8SFLOOR|${K8SFLOOR}|g" source/conf.py
9594
9695 @echo "Updating Helm Charts"
9796# @$(shell curl --retry 10 -Ls -o source/includes/k8s/operator-values.yaml https://raw.githubusercontent.com/minio/operator/v${OPERATOR}/helm/operator/values.yaml)
9897
9998sync-kes-version :
10099 @echo " Retrieving latest stable KES version"
101100 @$(eval KES = $(shell curl --retry 10 -Ls -o /dev/null -w "% {url_effective}" https://github.com/minio/kes/releases/latest | sed "s/https:\/\/github.com\/minio\/kes\/releases\/tag\///") )
102- @$(eval kname = $(shell uname -s) )
103-
104- @case "${kname}" in \
105- "Darwin") \
106- sed -i "" "s|KESLATEST|${KES}|g" source/conf.py;\
107- ;; \
108- *) \
109- sed -i "s|KESLATEST|${KES}|g" source/conf.py; \
110- ;; \
111- esac
101+ @$(SED_INPLACE ) " s|KESLATEST|${KES} |g" source/conf.py
112102
113103sync-minio-server-docs :
114104 @echo " Retrieving select docs from github.com/minio/minio/docs"
0 commit comments