Add iteration

This commit is contained in:
David Newhall II 2019-07-08 14:08:05 -07:00
parent d48845d269
commit 52ea85434a
1 changed files with 8 additions and 8 deletions

View File

@ -21,7 +21,7 @@ VERSION_PATH:=github.com/$(GHUSER)/$(BINARY)/$(shell echo $(BINARY) | tr -d -- -
# md2roff turns markdown into man files and html files.
MD2ROFF_BIN=github.com/github/hub/md2roff-bin
# This produces a 0 in some envirnoments (like Docker), but it's only used for packages.
# This produces a 0 in some envirnoments (like Homebrew), but it's only used for packages.
ITERATION:=$(shell git rev-list --count --all || echo 0)
# Travis CI passes the version in. Local builds get it from the current git tag.
ifeq ($(VERSION),)
@ -81,40 +81,40 @@ README.html: md2roff
build: $(BINARY)
$(BINARY):
go build -o $(BINARY) -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
go build -o $(BINARY) -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
linux: $(BINARY).amd64.linux
$(BINARY).amd64.linux:
# Building linux 64-bit x86 binary.
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
linux386: $(BINARY).i386.linux
$(BINARY).i386.linux:
# Building linux 32-bit x86 binary.
GOOS=linux GOARCH=386 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=linux GOARCH=386 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
arm: arm64 armhf
arm64: $(BINARY).arm64.linux
$(BINARY).arm64.linux:
# Building linux 64-bit ARM binary.
GOOS=linux GOARCH=arm64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=linux GOARCH=arm64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
armhf: $(BINARY).armhf.linux
$(BINARY).armhf.linux:
# Building linux 32-bit ARM binary.
GOOS=linux GOARCH=arm GOARM=6 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=linux GOARCH=arm GOARM=6 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
macos: $(BINARY).amd64.macos
$(BINARY).amd64.macos:
# Building darwin 64-bit x86 binary.
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
exe: $(BINARY).amd64.exe
windows: $(BINARY).amd64.exe
$(BINARY).amd64.exe:
# Building windows 64-bit x86 binary.
GOOS=windows GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)"
GOOS=windows GOARCH=amd64 go build -o $@ -ldflags "-w -s -X $(VERSION_PATH)=$(VERSION)-$(ITERATION)"
# Packages