summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 17:25:54 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 17:26:30 +0100
commit898a31f393577f7f5682434bd607a68010fd888f (patch)
treeaa22d985de6943c5e866016e15f98eee5db47c78
parent0ddbe56c19c6fc820bc7011abc22c371c9244d88 (diff)
Fixed subversion when tag doesn't include dash.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--.gitignore3
-rw-r--r--Makefile16
2 files changed, 12 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index df22b67..a5007eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ tools
package
debug
cmd/*/debug
+*.zip
webapp/dist
webapp/node_modules
@@ -12,4 +13,4 @@ webapp/assets/xds-agent-tarballs/*.zip
# private (prefixed by 2 underscores) directories or files
__*/
-__* \ No newline at end of file
+__*
diff --git a/Makefile b/Makefile
index da756ce..adb1235 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,9 @@ 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)))
+ifeq (-,$(findstring -,$(GIT_DESC)))
SUB_VERSION := $(subst $(VERSION)-,,$(GIT_DESC))
+endif
ifeq ($(VERSION), )
VERSION := unknown-dev
endif
@@ -69,17 +71,19 @@ ifeq ($(filter 1,$(RELEASE) $(REL)),)
# disable compiler optimizations and inlining
GO_GCFLAGS=-N -l
BUILD_MODE="Debug mode"
+ WEBAPP_BUILD_RULE=build
else
# optimized code without debug info
GO_LDFLAGS=-s -w
GO_GCFLAGS=
BUILD_MODE="Release mode"
+ WEBAPP_BUILD_RULE=build:prod
endif
ifeq ($(SUB_VERSION), )
- PACKAGE_ZIPFILE := xds-server_$(ARCH)-$(VERSION).zip
+ PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-$(VERSION).zip
else
- PACKAGE_ZIPFILE := xds-server_$(ARCH)-$(VERSION)_$(SUB_VERSION).zip
+ PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-$(VERSION)_$(SUB_VERSION).zip
endif
@@ -89,8 +93,8 @@ all: tools/syncthing build
build: checkgover vendor xds webapp
xds: scripts tools/syncthing/copytobin
- @echo "### Build XDS server (version $(VERSION), subversion $(SUB_VERSION), $(BUILD_MODE))";
- @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/xds-server$(EXT) -ldflags "$(GO_LDFLAGS) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" -gcflags "$(GO_GCFLAGS)" .
+ @echo "### Build XDS server (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
+ @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/$(TARGET)$(EXT) -ldflags "$(GO_LDFLAGS) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" -gcflags "$(GO_GCFLAGS)" .
test: tools/glide
go test --race $(shell $(LOCAL_TOOLSDIR)/glide novendor)
@@ -102,10 +106,10 @@ fmt: tools/glide
go fmt $(shell $(LOCAL_TOOLSDIR)/glide novendor)
run: build/xds tools/syncthing/copytobin
- $(LOCAL_BINDIR)/xds-server$(EXT) --log info -c config.json.in
+ $(LOCAL_BINDIR)/$(TARGET)$(EXT) --log info -c config.json.in
debug: build/xds tools/syncthing/copytobin
- $(LOCAL_BINDIR)/xds-server$(EXT) --log debug -c config.json.in
+ $(LOCAL_BINDIR)/$(TARGET)$(EXT) --log debug -c config.json.in
.PHONY: clean
clean: