diff --git a/scripts/make_version.sh b/scripts/make_version.sh new file mode 100755 index 0000000000000000000000000000000000000000..ba2684084b6ff17567286ef0208a46eda0c95103 --- /dev/null +++ b/scripts/make_version.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo -n 'const char tarantool_version_string[] = "' +git tag | tail -n 1 | tr -d \\n +echo -n " +"$(git log --oneline $(git tag | tail -n1)..HEAD | wc -l)"commits " +git log -1 --format='%h' | tr -d \\n +git diff --quiet || (echo -n ' AND'; git diff --shortstat) | tr -d \\n +echo '";' diff --git a/scripts/rules.mk b/scripts/rules.mk index 459c3d55ee83f23eb787ce64120c833541e0d89d..26d7d93fb17beccc396605aa4b1dfc57057528f9 100644 --- a/scripts/rules.mk +++ b/scripts/rules.mk @@ -99,10 +99,7 @@ endif ifeq ($(HAVE_GIT),1) tarantool_version.h: FORCE - @echo -n "const char tarantool_version_string[] = " > $@_ - @git show HEAD | sed 's/commit \(.*\)/\"\1/;q' | tr -d \\n >> $@_ - @git diff --quiet || (echo -n ' AND'; git diff --shortstat) | tr -d \\n >> $@_ - @echo '";' >> $@_ + @$(SRCDIR)/scripts/make_version.sh > $@_ @diff -q $@ $@_ 2>/dev/null >/dev/null || ($(ECHO) " GEN " $(notdir $@); cp $@_ $@) FORCE: endif