Skip to content

Commit

Permalink
+makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Dec 29, 2019
1 parent b470e10 commit decfbe0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
LAST_TAG := $(shell git describe --abbrev=0 --always --tags)
BUILD := $(shell git rev-parse $(LAST_TAG))

BINARY := heksa
UNIXBINARY := $(BINARY)
WINBINARY := $(UNIXBINARY).exe
BUILDDIR := build

LINUXRELEASE := $(BINARY)-$(LAST_TAG)-linux-x64.tar.gz
WINRELEASE := $(BINARY)-$(LAST_TAG)-windows-x64.zip

LDFLAGS := -ldflags "-s -w -X=main.VERSION=$(LAST_TAG) -X=main.BUILD=$(BUILD)"

bin:
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -v -o $(BUILDDIR)/$(UNIXBINARY)
upx -v -9 $(BUILDDIR)/$(UNIXBINARY)

bin-windows:
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -v -o $(BUILDDIR)/$(WINBINARY)
upx -v -9 $(BUILDDIR)/$(WINBINARY)

release:
cd $(BUILDDIR); tar cvzf $(LINUXRELEASE) $(UNIXBINARY)

release-windows:
cd $(BUILDDIR); zip -v -9 $(WINRELEASE) $(WINBINARY)

.PHONY: all clean test

0 comments on commit decfbe0

Please sign in to comment.