From: Willy Tarreau Date: Sat, 22 Jun 2019 06:24:16 +0000 (+0200) Subject: BUILD: makefile: do not rely on shell substitutions to determine git version X-Git-Tag: v2.1-dev1~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c55efb7dd0603023cc33bfce914073945140898;p=thirdparty%2Fhaproxy.git 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. --- 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")