Skip to content

Commit 6ffdabf

Browse files
committed
Makefile: fix shim tags overwritten
Go taks multiple `--tags` as overwriting the previously set ones, which is not what we want. Signed-off-by: Brian Goff <[email protected]>
1 parent 01ca26f commit 6ffdabf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ GO_BUILDTAGS += ${DEBUG_TAGS}
9696
ifneq ($(STATIC),)
9797
GO_BUILDTAGS += osusergo netgo static_build
9898
endif
99+
100+
SHIM_GO_BUILDTAGS := $(GO_BUILDTAGS) no_grpc
101+
99102
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",)
103+
SHIM_GO_TAGS=$(if $(SHIM_GO_BUILDTAGS),-tags "$(strip $(SHIM_GO_BUILDTAGS))",)
100104

101105
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)
102106
ifneq ($(STATIC),)
@@ -150,7 +154,6 @@ GOTEST ?= $(GO) test
150154
OUTPUTDIR = $(join $(ROOTDIR), _output)
151155
CRIDIR=$(OUTPUTDIR)/cri
152156

153-
SHIM_GO_TAGS := --tags no_grpc
154157

155158
.PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man install-doc genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test remove-replace clean-vendor
156159
.DEFAULT: default
@@ -267,7 +270,7 @@ bin/gen-manpages: cmd/gen-manpages FORCE
267270

268271
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
269272
@echo "$(WHALE) $@"
270-
CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o $@ ${SHIM_GO_LDFLAGS} ${GO_TAGS} ${SHIM_GO_TAGS} ./cmd/containerd-shim-runc-v2
273+
CGO_ENABLED=${SHIM_CGO_ENABLED} $(GO) build ${GO_BUILD_FLAGS} -o $@ ${SHIM_GO_LDFLAGS} ${SHIM_GO_TAGS} ./cmd/containerd-shim-runc-v2
271274

272275
binaries: $(BINARIES) ## build binaries
273276
@echo "$(WHALE) $@"

0 commit comments

Comments
 (0)