From be668f21e807b026e4c5cd7efd862eb8a97d014b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 24 Aug 2021 06:47:38 +0300 Subject: [PATCH] tag version --- Makefile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8259f11..ad42f7a 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,21 @@ GODEPS = $(shell git ls-files '*.go' go.mod go.sum) GOBIN = $(shell go env GOPATH)/bin/ -GOOSARCHS = linux/amd64 \ - linux/arm64 \ - darwin/amd64 \ - darwin/arm64 \ - windows/amd64/.exe +GOOSARCHS = $(sort \ + linux/amd64 \ + linux/arm64 \ + darwin/amd64 \ + darwin/arm64 \ + windows/amd64/.exe \ + ) + +VERSION = $(shell git describe --dirty) +LDFLAGS = -ldflags "-X main.Version=$(VERSION)" define undockertarget -UNDOCKERS += undocker-$(1)-$(2)$(firstword $(3)) -undocker-$(1)-$(2)$(firstword $(3)): $(GODEPS) - CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -o $$@ +UNDOCKERS += undocker-$(1)-$(2)-$(VERSION)-$(firstword $(3)) +undocker-$(1)-$(2)-$(VERSION)$(firstword $(3)): $(GODEPS) + CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build $(LDFLAGS) -o $$@ endef $(foreach goosarch,$(GOOSARCHS),\