Skip to content

Commit c752d04

Browse files
committed
(makefile) Dynamically set GOARCH flag while building binaries
The GOARCH flag was hardcoded to "386", which causes the binaries to not work properly on machines with arm64 arch. This PR dynamically sets the GOARCH flag instead of hardcoding to a particular value. Signed-off-by: anik120 <[email protected]>
1 parent caab6c5 commit c752d04

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PKG := $(ORG)/operator-lifecycle-manager
1414
MOD_FLAGS := $(shell (go version | grep -q -E "1\.1[1-9]") && echo -mod=vendor)
1515
BUILD_TAGS := "json1"
1616
CMDS := $(shell go list $(MOD_FLAGS) ./cmd/...)
17+
ARCH := $(shell arch)
1718
TCMDS := $(shell go list $(MOD_FLAGS) ./test/e2e/...)
1819
MOCKGEN := ./scripts/update_mockgen.sh
1920
CODEGEN := ./scripts/update_codegen.sh
@@ -82,15 +83,15 @@ build-coverage: build_cmd=test -c -covermode=count -coverpkg ./pkg/controller/..
8283
build-coverage: clean $(CMDS)
8384

8485
build-linux: build_cmd=build
85-
build-linux: arch_flags=GOOS=linux GOARCH=386
86+
build-linux: arch_flags=GOOS=linux GOARCH=$(ARCH)
8687
build-linux: clean $(CMDS)
8788

8889
build-wait: clean bin/wait
8990

9091
bin/wait: FORCE
91-
GOOS=linux GOARCH=386 go build $(MOD_FLAGS) -o $@ $(PKG)/test/e2e/wait
92+
GOOS=linux GOARCH=$(ARCH) go build $(MOD_FLAGS) -o $@ $(PKG)/test/e2e/wait
9293

93-
build-util-linux: arch_flags=GOOS=linux GOARCH=386
94+
build-util-linux: arch_flags=GOOS=linux GOARCH=$(ARCH)
9495
build-util-linux: build-util
9596

9697
build-util: bin/cpb

0 commit comments

Comments
 (0)