Makefile: make VSNHASH, LDFLAGS overridable

This commit is contained in:
Motiejus Jakštys 2024-05-12 07:33:29 +03:00
parent 5aa28f74ee
commit 6400df9612

View File

@ -1,9 +1,9 @@
SCRIPTS = $(shell awk '/#!\/usr\/bin\/env (ba)?sh/&&FNR==1{print FILENAME}' $(shell git ls-files)) SCRIPTS := $(shell awk '/#!\/usr\/bin\/env (ba)?sh/&&FNR==1{print FILENAME}' $(shell git ls-files))
GODEPS = $(shell git ls-files '*.go' go.mod go.sum) GODEPS := $(shell git ls-files '*.go' go.mod go.sum)
VSN ?= $(shell git describe --dirty) VSN ?= $(shell git describe --dirty)
VSNHASH = $(shell git rev-parse --verify HEAD) VSNHASH ?= $(shell git rev-parse --verify HEAD)
LDFLAGS = -ldflags "-X main.Version=$(VSN) -X main.VersionHash=$(VSNHASH)" LDFLAGS ?= -ldflags "-X main.Version=$(VSN) -X main.VersionHash=$(VSNHASH)"
undocker: ## builds binary for the current architecture undocker: ## builds binary for the current architecture
go build $(LDFLAGS) -o $@ go build $(LDFLAGS) -o $@