From 3c55efb7dd0603023cc33bfce914073945140898 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 22 Jun 2019 08:24:16 +0200 Subject: [PATCH] BUILD: makefile: do not rely on shell substitutions to determine git version Solaris's default shell doesn't support substitutions at the beginning or end of variables, which are still used to determine the version based on git. Since we added --abbrev=0 we don't need the last one. And using cut it's trivial to replace the first one, actually simplifying the whole expression. This may be backported to all stable branches. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3d67fd27f1..54d345f08a 100644 --- a/Makefile +++ b/Makefile @@ -396,7 +396,7 @@ $(set_target_defaults) # holding the same names in the current directory. ifeq ($(IGNOREGIT),) -VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*' --abbrev=0) 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}") +VERSION := $(shell [ -d .git/. ] && (git describe --tags --match 'v*' --abbrev=0 | cut -c 2-) 2>/dev/null) ifneq ($(VERSION),) # OK git is there and works. SUBVERS := $(shell comms=`git log --format=oneline --no-merges v$(VERSION).. 2>/dev/null | wc -l | tr -d '[:space:]'`; commit=`(git log -1 --pretty=%h --abbrev=6) 2>/dev/null`; [ $$comms -gt 0 ] && echo "-$$commit-$$comms") -- 2.47.3