summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-07 11:27:08 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-07 11:27:08 +0200
commit09be103ad9fd3d468db65b4c885738336d55df98 (patch)
tree972217f7379e5a6c6bc332662fe21c1f424e1fde /Makefile
parent62b67b5e764d8dacbb2783311d6c29ff9130c5ea (diff)
Add package-all rule support.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 25 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index fc6a603..d7ad5c2 100644
--- a/Makefile
+++ b/Makefile
@@ -13,12 +13,19 @@ SYNCTHING_INOTIFY_VERSION = master
# Retrieve git tag/commit to set sub-version string
ifeq ($(origin SUB_VERSION), undefined)
- SUB_VERSION := $(shell git describe --tags --always | sed 's/^v//')
- ifeq ($(SUB_VERSION), )
- SUB_VERSION=unknown-dev
+ SUB_VERSION := $(shell git describe --tags 2>/dev/null | sed 's/^v//')
+ ifneq ($(SUB_VERSION), )
+ VERSION := $(firstword $(subst -, ,$(SUB_VERSION)))
+ SUB_VERSION := $(word 2,$(subst -, ,$(SUB_VERSION)))
+ else
+ SUB_VERSION := $(shell git describe --tags --always | sed 's/^v//')
+ ifeq ($(SUB_VERSION), )
+ SUB_VERSION := unknown-dev
+ endif
endif
endif
+
# Configurable variables for installation (default /usr/local/...)
ifeq ($(origin INSTALL_DIR), undefined)
INSTALL_DIR := /usr/local/bin
@@ -57,6 +64,13 @@ else
BUILD_MODE="Release mode"
endif
+ifeq ($(SUB_VERSION), )
+ PACKAGE_ZIPFILE := xds-agent_$(ARCH)-v$(VERSION).zip
+else
+ PACKAGE_ZIPFILE := xds-agent_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip
+endif
+
+
all: tools/syncthing build
build: vendor tools/syncthing/copytobin
@@ -67,7 +81,14 @@ package: clean build
@mkdir -p $(PACKAGE_DIR)/xds-agent
@cp agent-config.json.in $(PACKAGE_DIR)/xds-agent/agent-config.json
@cp -a $(LOCAL_BINDIR)/* $(PACKAGE_DIR)/xds-agent
- cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/xds-agent_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip ./xds-agent
+ cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE) ./xds-agent
+
+.PHONY: package-all
+package-all:
+ @echo "# Build linux amd64..."
+ GOOS=linux GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
+ @echo "# Build windows amd64..."
+ GOOS=windows GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
test: tools/glide
go test --race $(shell ./tools/glide novendor)