Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit c637bd5

Browse files
authored
Merge pull request #762 from dghubble/multi-arch
Makefile: Cross-compile checkpointer for multiple archs
2 parents 107e358 + 49fa2dc commit c637bd5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ GOPATH_BIN:=$(shell echo ${GOPATH} | awk 'BEGIN { FS = ":" }; { print $1 }')/bin
88
LDFLAGS=-X github.com/kubernetes-incubator/bootkube/pkg/version.Version=$(shell $(CURDIR)/build/git-version.sh)
99

1010
all: \
11+
_output/bin/linux/bootkube \
12+
_output/bin/darwin/bootkube \
13+
_output/bin/linux/checkpoint
14+
15+
cross: \
1116
_output/bin/linux/bootkube \
1217
_output/bin/darwin/bootkube \
1318
_output/bin/linux/checkpoint \
19+
_output/bin/linux/amd64/checkpoint \
20+
_output/bin/linux/arm/checkpoint \
21+
_output/bin/linux/arm64/checkpoint \
22+
_output/bin/linux/ppc64le/checkpoint \
23+
_output/bin/linux/s390x/checkpoint
1424

1525
release: \
1626
clean \
@@ -25,9 +35,12 @@ check:
2535
install: _output/bin/$(LOCAL_OS)/bootkube
2636
cp $< $(GOPATH_BIN)
2737

38+
_output/bin/%: GOOS=$(word 1, $(subst /, ,$*))
39+
_output/bin/%: GOARCH=$(word 2, $(subst /, ,$*))
40+
_output/bin/%: GOARCH:=amd64 # default to amd64 to support release scripts
2841
_output/bin/%: $(GOFILES)
2942
mkdir -p $(dir $@)
30-
GOOS=$(word 1, $(subst /, ,$*)) go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ github.com/kubernetes-incubator/bootkube/cmd/$(notdir $@)
43+
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ github.com/kubernetes-incubator/bootkube/cmd/$(notdir $@)
3144

3245
_output/release/bootkube.tar.gz: _output/bin/linux/bootkube _output/bin/darwin/bootkube _output/bin/linux/checkpoint
3346
mkdir -p $(dir $@)

0 commit comments

Comments
 (0)