From 2daa2ff411ec1aaf0e933ae4c66fcaecdd40a0ee Mon Sep 17 00:00:00 2001 From: Maysun J Faisal Date: Mon, 26 Feb 2024 15:12:06 -0500 Subject: [PATCH] Add arch support for local go build Signed-off-by: Maysun J Faisal --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fee41d23d..433c3ed08 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,10 @@ APPLICATION_API_CRD = https://raw.githubusercontent.com/redhat-appstudio/applica # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.22 +# Get the local platform +OS=$(shell go env GOOS) +ARCH=$(shell go env GOARCH) + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -88,6 +92,9 @@ help: ## Display this help. ##@ Development +platform_info: + $(info OS is $(OS) and ARCH is $(ARCH)) + manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." @@ -164,7 +171,7 @@ test: manifests generate fmt vet envtest ## Run tests. ##@ Build build: generate fmt vet ## Build manager binary. - go build -o bin/manager main.go + GOOS=${OS} GOARCH=${ARCH} go build -o bin/manager main.go run: manifests generate fmt vet ## Run a controller from your host. go run ./main.go @@ -249,7 +256,6 @@ ifeq (,$(shell which opm 2>/dev/null)) @{ \ set -e ;\ mkdir -p $(dir $(OPM)) ;\ - OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\ chmod +x $(OPM) ;\ }