summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-09-13 10:05:09 +0200
committerMartin Polden <mpolden@mpolden.no>2021-09-13 13:49:05 +0200
commite2b865ea5d9d7fe19143d7419a6bcc06be211ee2 (patch)
tree9aac1906476583f73443cddde5ee155f2dddb38e /client
parente5154033584d4caddbab673713f74e48f07b4388 (diff)
Add cross-platform targets
Diffstat (limited to 'client')
-rw-r--r--client/go/Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/client/go/Makefile b/client/go/Makefile
index 3297b628cb2..452dc710a0d 100644
--- a/client/go/Makefile
+++ b/client/go/Makefile
@@ -5,17 +5,32 @@ SHARE ?= $(CURDIR)/share
# When building a new release the build system should set the VERSION
# environment variable to version being built
VERSION ?= $(shell echo "0.0.0-`git rev-parse --short HEAD`")
+GO_FLAGS := -ldflags "-X github.com/vespa-engine/vespa/client/go/build.Version=$(VERSION)"
all: test checkfmt install
-install:
- env GOBIN=$(BIN) \
- go install -ldflags "-X github.com/vespa-engine/vespa/client/go/build.Version=$(VERSION)" ./...
+# Cross-platform build targets
+build-mac: GOOS=darwin
+build-mac: xbuild
+
+build-linux: GOOS=linux
+build-linux: xbuild
+
+build-win: GOOS=windows
+build-win: xbuild
+
+xbuild:
+ mkdir -p bin/$(GOOS)_amd64
+ env GOOS=$(GOOS) go build -o bin/$(GOOS)_amd64 $(GO_FLAGS) ./...
manpages: install
mkdir -p $(SHARE)/man/man1
$(BIN)/vespa man $(SHARE)/man/man1
+# Development targets
+install:
+ env GOBIN=$(BIN) go install $(GO_FLAGS) ./...
+
clean:
rm -rf $(BIN) $(SHARE)