File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ LAST_TAG := $(shell git describe --abbrev=0 --always --tags)
2+ BUILD := $(shell git rev-parse $(LAST_TAG ) )
3+
4+ BINARY := ip-range-to-cidr
5+ UNIXBINARY := $(BINARY )
6+ WINBINARY := $(UNIXBINARY ) .exe
7+ BUILDDIR := build
8+
9+ LINUXRELEASE := $(BINARY ) -$(LAST_TAG ) -linux-x64.tar.gz
10+ WINRELEASE := $(BINARY ) -$(LAST_TAG ) -windows-x64.zip
11+
12+ LDFLAGS := -ldflags "-s -w -X=main.VERSION=$(LAST_TAG ) -X=main.BUILD=$(BUILD ) "
13+
14+ bin :
15+ GOOS=linux GOARCH=amd64 go build $(LDFLAGS ) -v -o $(BUILDDIR ) /$(UNIXBINARY )
16+ upx -v -9 $(BUILDDIR ) /$(UNIXBINARY )
17+
18+ bin-windows :
19+ GOOS=windows GOARCH=amd64 go build $(LDFLAGS ) -v -o $(BUILDDIR ) /$(WINBINARY )
20+ upx -v -9 $(BUILDDIR ) /$(WINBINARY )
21+
22+ release :
23+ cd $(BUILDDIR ) ; tar cvzf $(LINUXRELEASE ) $(UNIXBINARY )
24+
25+ release-windows :
26+ cd $(BUILDDIR ) ; zip -v -9 $(WINRELEASE ) $(WINBINARY )
27+
28+ .PHONY : all clean test
You can’t perform that action at this time.
0 commit comments