diff --git a/Makefile b/Makefile index dfa66f00..9e6a7bd3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,25 @@ # Image URL to use all building/pushing image targets IMG ?= quay.io/konveyor/oadp-non-admin:latest + +SED = sed +# if on macos, install gsed +# https://formulae.brew.sh/formula/gnu-sed + +# Codecov OS String for use in download url +ifeq ($(OS),Windows_NT) + OS_String = windows +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + OS_String = linux + endif + ifeq ($(UNAME_S),Darwin) + OS_String = macos + SED = gsed + endif +endif + # Kubernetes version from OpenShift 4.16.x https://openshift-release.apps.ci.l2s4.p1.openshiftapps.com/#4-stable # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29 @@ -109,7 +128,7 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le .PHONY: docker-buildx docker-buildx: ## Build and push docker image for the manager for cross-platform support # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile - sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross + $(SED) -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - $(CONTAINER_TOOL) buildx create --name project-v3-builder $(CONTAINER_TOOL) buildx use project-v3-builder - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . @@ -199,7 +218,7 @@ set -e; \ package=$(2)@$(3) ;\ echo "Downloading $${package}" ;\ GOBIN=$(LOCALBIN) go install $${package} ;\ -mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\ +mv "$$(echo "$(1)" | $(SED) "s/-$(3)$$//")" $(1) ;\ } endef @@ -287,10 +306,10 @@ endif @{ \ NAC_VELERO_VERSION=$(shell grep -I 'github.com/openshift/velero' $(shell pwd)/go.mod | awk -F' ' '{print $$5}') ;\ OADP_VELERO_VERSION=$(shell grep -I 'github.com/openshift/velero' $(OADP_OPERATOR_PATH)/go.mod | awk -F' ' '{print $$5}') ;\ - sed -i "s%$$NAC_VELERO_VERSION%$$OADP_VELERO_VERSION%" $(shell pwd)/go.mod ;\ + $(SED) -i "s%$$NAC_VELERO_VERSION%$$OADP_VELERO_VERSION%" $(shell pwd)/go.mod ;\ for file_name in $(shell ls $(shell pwd)/hack/extra-crds);do \ cp $(OADP_OPERATOR_PATH)/config/crd/bases/$$file_name $(shell pwd)/hack/extra-crds/$$file_name && \ - sed -i "1s%^%# Code generated by make update-velero-manifests. DO NOT EDIT.\n%" $(shell pwd)/hack/extra-crds/$$file_name;done ;\ + $(SED) -i "1s%^%# Code generated by make update-velero-manifests. DO NOT EDIT.\n%" $(shell pwd)/hack/extra-crds/$$file_name;done ;\ΒΈ } .PHONY: docker-buildx-nac