From 0747980c3e8bf101abee2aad730f03da1411d318 Mon Sep 17 00:00:00 2001 From: umarcor Date: Tue, 5 Jan 2021 14:17:46 +0100 Subject: version: add Ref and Hash --- Makefile.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Makefile.in') diff --git a/Makefile.in b/Makefile.in index c089789d5..d3c2c8190 100644 --- a/Makefile.in +++ b/Makefile.in @@ -163,9 +163,21 @@ GRTSRCDIR=$(abs_srcdir)/src/grt include $(srcdir)/src/grt/Makefile.inc version.tmp: $(srcdir)/src/version.in force -# Create version.tmp from version.in, using git date/hash, or envvar GHDL_DESC. Defaults to 'tarball'. - if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty`; then GHDL_DESC="$$desc"; fi; \ - $(SED) -e "s/[(].*[)]/($$GHDL_DESC)/" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \ +# Create version.tmp from version.in, using git date/hash, or envvars. + GHDL_VER_DESC=$${GHDL_VER_DESC:-tarball}; \ + GHDL_VER_REF=$${GHDL_VER_REF:-unknown}; \ + GHDL_VER_HASH=$${GHDL_VER_HASH:-unknown}; \ + if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty --long`; then \ + GHDL_VER_DESC=`echo $$desc | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g' -e 's/^v//g'`; \ + GHDL_VER_REF=`cd $(srcdir); git rev-parse --abbrev-ref HEAD`; \ + GHDL_VER_HASH=`cd $(srcdir); git rev-parse HEAD`; \ + fi; \ + sed \ + -e "s#@VER@#$(ghdl_version)#" \ + -e "s#@DESC@#$${GHDL_VER_DESC}#" \ + -e "s#@REF@#$${GHDL_VER_REF}#" \ + -e "s#@HASH@#$${GHDL_VER_HASH}#" \ + < $< > $@; version.ads: version.tmp # Change version.ads only if version.tmp has been modified to avoid -- cgit v1.2.3