summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-03-06 21:38:03 -0500
committerDave Henderson <dhenderson@gmail.com>2017-03-06 21:45:24 -0500
commit65c4abc5ed0798d37afdc3e7729f52106c089577 (patch)
tree67eee4662b54747507f984082db013925b86c168 /Makefile
parentcb41adfbcc48840ea765820ca230525e7017fea7 (diff)
Build optimizations
- produce smaller binaries by disabling symbol table and DWARF (debug info) generation - these alone reduce binary size by ~30% - adding `linux_arm64` platform - stop compressing rarely-used 32-bit windows/linux builds Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 3 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 8c050c73..fbfaa757 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ VERSION_FLAG := -X `go list ./version`.Version=$(VERSION)
define gocross
GOOS=$(1) GOARCH=$(2) \
$(GO) build \
- -ldflags "$(COMMIT_FLAG) $(VERSION_FLAG)" \
+ -ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" \
-o $(PREFIX)/bin/$(PKG_NAME)_$(1)-$(2)$(call extension,$(1));
endef
@@ -28,22 +28,20 @@ build-x: $(shell find . -type f -name '*.go')
$(call gocross,linux,amd64)
$(call gocross,linux,386)
$(call gocross,linux,arm)
+ $(call gocross,linux,arm64)
$(call gocross,darwin,amd64)
$(call gocross,windows,amd64)
$(call gocross,windows,386)
compress-all:
$(call compress,linux,amd64)
- $(call compress,linux,386)
$(call compress,linux,arm)
- $(call compress,darwin,amd64)
$(call compress,windows,amd64)
- $(call compress,windows,386)
build-release: clean build-x compress-all
$(PREFIX)/bin/$(PKG_NAME)$(call extension,$(GOOS)): $(shell find . -type f -name '*.go')
- $(GO) build -ldflags "$(COMMIT_FLAG) $(VERSION_FLAG)" -o $@
+ $(GO) build -ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" -o $@
build: $(PREFIX)/bin/$(PKG_NAME)$(call extension,$(GOOS))