diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-13 11:35:49 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-13 14:15:17 +0200 |
commit | 060f5acbf430f5219db8c676f35034489fa86c6c (patch) | |
tree | 30e3a4fed5a05511f87f84e03709b991d9112b1d /client/go/Makefile | |
parent | 25ea74b5887bedc8f75f27737011011142a8c2d0 (diff) |
Package releases
Diffstat (limited to 'client/go/Makefile')
-rw-r--r-- | client/go/Makefile | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/client/go/Makefile b/client/go/Makefile index c827cc19f56..de66b7c8fb1 100644 --- a/client/go/Makefile +++ b/client/go/Makefile @@ -6,7 +6,11 @@ VERSION ?= $(shell echo "0.0.0-`git rev-parse --short HEAD`") BIN ?= $(CURDIR)/bin SHARE ?= $(CURDIR)/share +DIST ?= $(CURDIR)/dist + GO_FLAGS := -ldflags "-X github.com/vespa-engine/vespa/client/go/build.Version=$(VERSION)" +GIT_ROOT := $(shell git rev-parse --show-toplevel) +DIST_TARGETS := dist-mac dist-linux dist-win32 dist-win64 all: test checkfmt install @@ -22,18 +26,32 @@ dist-homebrew: # Cross-platform build targets # -build-mac: GOOS=darwin -build-mac: xbuild +dist: $(DIST_TARGETS) sha256sums + +dist-mac: GOOS=darwin +dist-mac: GOARCH=amd64 + +dist-linux: GOOS=linux +dist-linux: GOARCH=amd64 -build-linux: GOOS=linux -build-linux: xbuild +dist-win32: GOOS=windows +dist-win32: GOARCH=386 -build-win: GOOS=windows -build-win: xbuild +dist-win64: GOOS=windows +dist-win64: GOARCH=amd64 -xbuild: - mkdir -p bin/$(GOOS)_amd64 - env GOOS=$(GOOS) go build -o bin/$(GOOS)_amd64 $(GO_FLAGS) ./... +$(DIST_TARGETS): DIST_NAME=vespa-cli_$(VERSION)_$(GOOS)_$(GOARCH) +$(DIST_TARGETS): manpages +$(DIST_TARGETS): + mkdir -p $(DIST)/$(DIST_NAME)/bin + env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(DIST)/$(DIST_NAME)/bin $(GO_FLAGS) ./... + cp -a $(GIT_ROOT)/LICENSE $(DIST)/$(DIST_NAME) + if [ "$(GOOS)" = "windows" ]; then \ + cd $(DIST) && zip -r $(DIST)/$(DIST_NAME).zip $(DIST_NAME); \ + else \ + cp -a share $(DIST)/$(DIST_NAME); \ + tar -czvf $(DIST)/$(DIST_NAME).tar.gz -C $(DIST) $(DIST_NAME); \ + fi # # Development targets @@ -47,7 +65,7 @@ manpages: install $(BIN)/vespa man $(SHARE)/man/man1 clean: - rm -rf $(BIN) $(SHARE) + rm -rf $(BIN) $(SHARE) $(DIST) test: go test ./... |