summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-26 23:12:49 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-26 23:12:49 +0200
commitb300a0413e9658aa2d9ebe0d4cddadc51881112a (patch)
tree7a1b0f428188c7ad336b117e8d9c2bbdfaef0c69 /Makefile
parent03f31ff8f44541fff15c3ff04ac75cb8e0274b79 (diff)
Add build release (REL=1 make all)
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 160b91a..fc6a603 100644
--- a/Makefile
+++ b/Makefile
@@ -47,11 +47,21 @@ export PATH := $(PATH):$(LOCAL_TOOLSDIR)
VERBOSE_1 := -v
VERBOSE_2 := -v -x
+# Release or Debug mode
+ifeq ($(filter 1,$(RELEASE) $(REL)),)
+ GORELEASE=
+ BUILD_MODE="Debug mode"
+else
+ # optimized code without debug info
+ GORELEASE= -s -w
+ BUILD_MODE="Release mode"
+endif
+
all: tools/syncthing build
build: vendor tools/syncthing/copytobin
- @echo "### Build XDS agent (version $(VERSION), subversion $(SUB_VERSION))";
- @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/xds-agent$(EXT) -ldflags "-X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" .
+ @echo "### Build XDS agent (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
+ @cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/xds-agent$(EXT) -ldflags "$(GORELEASE) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" .
package: clean build
@mkdir -p $(PACKAGE_DIR)/xds-agent