-# Makefile used to build XDS daemon Web Server
-
-# Application Version
-VERSION := 0.3.4
+# Makefile used to build XDS Server
# Syncthing version to install
-SYNCTHING_VERSION = 0.14.28
-SYNCTHING_INOTIFY_VERSION = 0.8.6
-
-
-# Retrieve git tag/commit to set sub-version string
-ifeq ($(origin SUB_VERSION), undefined)
- SUB_VERSION := $(shell git describe --exact-match --tags 2>/dev/null | sed 's/^v//')
- ifneq ($(SUB_VERSION), )
- VERSION := $(firstword $(subst -, ,$(SUB_VERSION)))
- SUB_VERSION := $(word 2,$(subst -, ,$(SUB_VERSION)))
- endif
- ifeq ($(SUB_VERSION), )
- SUB_VERSION := $(shell git rev-parse --short HEAD)
- ifeq ($(SUB_VERSION), )
- SUB_VERSION := unknown-dev
- endif
- endif
+SYNCTHING_VERSION = 0.14.38
+SYNCTHING_INOTIFY_VERSION = 0.8.7
+
+
+# Retrieve git tag/commit to set version & sub-version strings
+GIT_DESC := $(shell git describe --always --tags)
+VERSION := $(firstword $(subst -, ,$(GIT_DESC)))
+SUB_VERSION := $(subst $(VERSION)-,,$(GIT_DESC))
+ifeq ($(VERSION), )
+ VERSION := unknown-dev
+endif
+ifeq ($(SUB_VERSION), )
+ SUB_VERSION := $(shell date +'%Y-%m-%d_%H%M%S')
endif
# for backward compatibility
export GOPATH := $(shell go env GOPATH):$(ROOT_GOPRJ)
export PATH := $(PATH):$(LOCAL_TOOLSDIR)
+# Check Go version
+GOVERSION := $(shell go version |grep -o '[0-9\.]*'|head -n 1)
+GOVERMAJ := $(shell echo $(GOVERSION) |cut -f1 -d.)
+GOVERMIN := $(shell echo $(GOVERSION) |cut -f2 -d.)
+CHECKGOVER := $(shell [ $(GOVERMAJ) -gt 1 -o \( $(GOVERMAJ) -eq 1 -a $(GOVERMIN) -ge 8 \) ] && echo true)
+CHECKERRMSG := "ERROR: Go version 1.8.1 or higher is requested (current detected version: $(GOVERSION))."
+
+
VERBOSE_1 := -v
VERBOSE_2 := -v -x
endif
ifeq ($(SUB_VERSION), )
- PACKAGE_ZIPFILE := xds-server_$(ARCH)-v$(VERSION).zip
+ PACKAGE_ZIPFILE := xds-server_$(ARCH)-$(VERSION).zip
else
- PACKAGE_ZIPFILE := xds-server_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip
+ PACKAGE_ZIPFILE := xds-server_$(ARCH)-$(VERSION)_$(SUB_VERSION).zip
endif
all: tools/syncthing build
.PHONY: build
-build: vendor xds webapp
+build: checkgover vendor xds webapp
xds: scripts tools/syncthing/copytobin
@echo "### Build XDS server (version $(VERSION), subversion $(SUB_VERSION), $(BUILD_MODE))";
run: build/xds tools/syncthing/copytobin
$(LOCAL_BINDIR)/xds-server$(EXT) --log info -c config.json.in
-debug: build/xds webapp/debug tools/syncthing/copytobin
+debug: build/xds tools/syncthing/copytobin
$(LOCAL_BINDIR)/xds-server$(EXT) --log debug -c config.json.in
.PHONY: clean
.PHONY: distclean
distclean: clean
- rm -rf $(LOCAL_BINDIR) $(ROOT_SRCDIR)/tools glide.lock vendor webapp/node_modules webapp/dist webapp/assets/xds-agent-tarballs/*.zip
+ rm -rf $(LOCAL_BINDIR) $(ROOT_SRCDIR)/tools glide.lock vendor $(ROOT_SRCDIR)/webapp/dist $(ROOT_SRCDIR)/webapp/node_modules
webapp: webapp/install
- (cd webapp && gulp build)
-
-webapp/debug:
- (cd webapp && gulp watch &)
+ mkdir -p $(ROOT_SRCDIR)/webapp/dist $(ROOT_SRCDIR)/webapp/dist/fonts
+ (cd $(ROOT_SRCDIR)/webapp && cp -a ./assets ./src/index.html ./node_modules/font-awesome/css/font-awesome.min.css ./dist/)
+ (cd $(ROOT_SRCDIR)/webapp && cp -a ./node_modules/font-awesome/fonts/* ./dist/fonts/)
webapp/install:
(cd webapp && npm install)
- @if [ -d ${DESTDIR}/usr/local/etc ]; then rm -rf ${DESTDIR}/usr; fi
.PHONY: scripts
scripts:
@mkdir -p $(LOCAL_BINDIR)
@cp -f $(LOCAL_TOOLSDIR)/syncthing$(EXT) $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) $(LOCAL_BINDIR)
+.PHONY:
+checkgover:
+ @test "$(CHECKGOVER)" = "true" || { echo $(CHECKERRMSG); exit 1; }
+
+
.PHONY: help
help:
@echo "Main supported rules:"