commit 0f13d56ba25db88a0836312eac8c2e1593d5865a
parent 7bfd62f6588af5f93a6a5683ff470e7164fde620
Author: Sean Enck <sean@ttypty.com>
Date: Sat, 17 Jun 2023 08:22:28 -0400
set version if not set
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,15 +1,15 @@
BUILD := bin/
TARGET := $(BUILD)lb
-VERSION :=
-ifeq ($(VERSION),)
-VERSION := $(shell git log -n 1 --format=%h)
-endif
+VERSION ?= $(shell git log -n 1 --format=%h)
all: $(TARGET)
build: $(TARGET)
$(TARGET): cmd/main.go internal/**/*.go go.* internal/cli/completions*
+ifeq ($(VERSION),)
+ $(error version not set)
+endif
go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o $@ cmd/main.go
unittests: