Skip to content

Commit

Permalink
Always set CGO_ENABLED=0
Browse files Browse the repository at this point in the history
Currently, CGO_ENABLED=0 is set only when building via 'make build'.
But the setting does not affect 'make cross', so release binaries are dynamically linked.

refs mackerelio#515
  • Loading branch information
fujiwara committed Mar 5, 2024
1 parent ea59751 commit 374ac5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BIN := mkr
VERSION := 0.55.0
CURRENT_REVISION := $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS := "-w -s -X main.gitcommit=$(CURRENT_REVISION)"
export CGO_ENABLED := 0

.PHONY: all
all: clean cross test rpm deb
Expand All @@ -16,7 +17,7 @@ test:

.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) .
go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) .

.PHONY: cross
cross: devel-deps
Expand Down

0 comments on commit 374ac5e

Please sign in to comment.