From: Sebastien Douheret Date: Wed, 7 Jun 2017 09:27:08 +0000 (+0200) Subject: Add package-all rule support. X-Git-Tag: 0.1.0~27 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=commitdiff_plain;h=09be103ad9fd3d468db65b4c885738336d55df98 Add package-all rule support. --- 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)