Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ endif
# build vtorc with CGO, because it depends on sqlite
CGO_ENABLED=1 go install $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/cmd/vtorc/...

# xbuild can be used to cross-compile Vitess client binaries
# Outside of select client binaries (namely vtctlclient & vtexplain), cross-compiled Vitess Binaries are not recommended for production deployments
# Usage: GOOS=darwin GOARCH=amd64 make xbuild
cross-build:
ifndef NOBANNER
echo $$(date): Building source tree
endif
bash ./build.env
# In order to cross-compile, go install requires GOBIN to be unset
export GOBIN=""
# For the specified GOOS + GOARCH, build all the binaries by default with CGO disabled
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go install $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
# unset GOOS and embed local resources in the vttablet executable
(cd go/cmd/vttablet && unset GOOS && go run github.com/GeertJohan/go.rice/rice --verbose append --exec=$${HOME}/go/bin/${GOOS}_${GOARCH}/vttablet)
# Cross-compiling w/ cgo isn't trivial and we don't need vtorc, so we can skip building it

debug:
ifndef NOBANNER
echo $$(date): Building source tree
Expand Down