Skip to content

Commit 4d77395

Browse files
authored
Merge pull request containerd#3796 from crosbymichael/cgo
Add CGO makefile flag
2 parents f9d8f0e + 84879b7 commit 4d77395

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ DESTDIR ?= /usr/local
2323
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
2424
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
2525
PACKAGE=github.com/containerd/containerd
26+
SHIM_CGO_ENABLED ?= 0
2627

2728
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
2829
GOOS ?= $(shell go env GOOS)
@@ -184,15 +185,15 @@ bin/%: cmd/% FORCE
184185

185186
bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
186187
@echo "$(WHALE) bin/containerd-shim"
187-
@CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
188+
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
188189

189190
bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
190191
@echo "$(WHALE) bin/containerd-shim-runc-v1"
191-
@CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
192+
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
192193

193194
bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
194195
@echo "$(WHALE) bin/containerd-shim-runc-v2"
195-
@CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
196+
@CGO_ENABLED=${SHIM_CGO_ENABLED} go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
196197

197198
binaries: $(BINARIES) ## build binaries
198199
@echo "$(WHALE) $@"

0 commit comments

Comments
 (0)