From ab7d32c1fe5182a7a7631bb4dc35bed49af752c0 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 29 Aug 2023 23:47:41 +0200 Subject: mk: evaluate variables with $(shell) Now that we use GNU make, instead of deferred evaluation when running the target commands, use $(shell) to evaluate commands when parsing the makefile and print prettier build commands. Before: go build -trimpath `contrib/goflags.sh` -ldflags \ "-X main.Version=`git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.15.2` \ -X main.Flags=$(echo -- `contrib/goflags.sh` | base64 | tr -d '\r\n') \ -X git.sr.ht/~rjarry/aerc/config.shareDir=/usr/local/share/aerc \ -X git.sr.ht/~rjarry/aerc/config.libexecDir=/usr/local/libexec/aerc" \ -o aerc After: go build -trimpath -tags=notmuch -ldflags \ "-X main.Version=0.15.2-174-gf25e038dacd7-dirty \ -X main.Flags=LS0gLXRhZ3M9bm90bXVjaAo= \ -X git.sr.ht/~rjarry/aerc/config.shareDir=/usr/local/share/aerc \ -X git.sr.ht/~rjarry/aerc/config.libexecDir=/usr/local/libexec/aerc" \ -o aerc Signed-off-by: Robin Jarry Acked-by: Moritz Poldrack --- GNUmakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'GNUmakefile') diff --git a/GNUmakefile b/GNUmakefile index 71aa2704..7704fcdb 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,17 +1,17 @@ # variables that can be changed by users # -VERSION ?= `git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.15.2` +VERSION ?= $(shell git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.15.2) PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/aerc LIBEXECDIR ?= $(PREFIX)/libexec/aerc MANDIR ?= $(PREFIX)/share/man GO ?= go -GOFLAGS ?= `contrib/goflags.sh` +GOFLAGS ?= $(shell contrib/goflags.sh) BUILD_OPTS ?= -trimpath GO_LDFLAGS := GO_LDFLAGS += -X main.Version=$(VERSION) -GO_LDFLAGS += -X main.Flags=$$(echo -- $(GOFLAGS) | base64 | tr -d '\r\n') +GO_LDFLAGS += -X main.Flags=$(shell echo -- $(GOFLAGS) | base64 | tr -d '\r\n') GO_LDFLAGS += -X git.sr.ht/~rjarry/aerc/config.shareDir=$(SHAREDIR) GO_LDFLAGS += -X git.sr.ht/~rjarry/aerc/config.libexecDir=$(LIBEXECDIR) GO_LDFLAGS += $(GO_EXTRA_LDFLAGS) -- cgit