From f7f1e7da2c7b7c7dfbede08260119ff9a99d1da8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 8 Jan 2020 17:59:58 -0500 Subject: [PATCH] Makefile: evaluate git version lazily Signed-off-by: Jason A. Donenfeld --- src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9221181..08389ef 100644 --- a/src/Makefile +++ b/src/Makefile @@ -46,9 +46,9 @@ CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\"" ifeq ($(DEBUG),yes) CFLAGS += -g endif -GIT_VERSION := $(shell GIT_CEILING_DIRECTORIES="$(PWD)/../.." git describe --dirty 2>/dev/null) -ifneq ($(GIT_VERSION),) -CFLAGS += -D'WIREGUARD_TOOLS_VERSION="$(GIT_VERSION:v%=%)"' +WIREGUARD_TOOLS_VERSION = $(patsubst v%,%,$(shell GIT_CEILING_DIRECTORIES="$(PWD)/../.." git describe --dirty 2>/dev/null)) +ifneq ($(WIREGUARD_TOOLS_VERSION),) +CFLAGS += -D'WIREGUARD_TOOLS_VERSION="$(WIREGUARD_TOOLS_VERSION)"' endif ifeq ($(PLATFORM),linux) LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null)