Skip to content

Commit

Permalink
build: leverage arch env variable in build
Browse files Browse the repository at this point in the history
Signed-off-by: Niki Dokovski <[email protected]>
  • Loading branch information
nickytd committed Oct 17, 2024
1 parent 0f39f47 commit e860a9b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
SHELL=/bin/bash -o pipefail

.DEFAULT_GOAL:=help

GOPATH := $(shell go env GOPATH)
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
Expand Down Expand Up @@ -55,15 +54,15 @@ IMAGE_TAG := falcosecurity/falcosidekick:latest
.PHONY: falcosidekick
falcosidekick:
$(GO) mod download
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o $@ .
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -trimpath -ldflags "$(LDFLAGS)" -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o $@ .

.PHONY: falcosidekick-linux-amd64
falcosidekick-linux-amd64:
.PHONY: falcosidekick-linux
falcosidekick-linux:
$(GO) mod download
GOOS=linux GOARCH=amd64 $(GO) build -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o falcosidekick .
GOOS=linux GOARCH=$(GOARCH) $(GO) build -ldflags "$(LDFLAGS)" -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o falcosidekick .

.PHONY: build-image
build-image: falcosidekick-linux-amd64
build-image: falcosidekick-linux
$(DOCKER) build -t $(IMAGE_TAG) .

.PHONY: push-image
Expand Down

0 comments on commit e860a9b

Please sign in to comment.