From: anthraxx Date: Wed, 18 May 2016 16:43:04 +0000 (+0200) Subject: fallback for Makefile version if its not a git checkout (tarball) X-Git-Tag: v3.00~171^2 X-Git-Url: https://www.flypig.org.uk/git/?a=commitdiff_plain;h=a4e1692647946d664e97fd9548c6b1643e9f60c2;hp=247d1931467c833b57a9258fa07c6bf3fa90dbee;p=hashcat.git fallback for Makefile version if its not a git checkout (tarball) This makes use of git export-subst to insert the current ref names. If git describe fails because because an extracted tarball is used to build from source then the fallback will get called and the last part of the ref names will be used for the version variable. if it is a git checkout and HEAD is the current tag: - v3.00-beta If it is a git checkout and HEAD is ahead of the latest tag: - v3.00-beta-36-g24a6095 If it is a tarball from a tag created via 'git archive HEAD --format=tar': - v3.00-beta If it is a tarball from the master created via 'git archive HEAD --format=tar': - master NOTE: If a tarball is manually created (without git archive) then the version will "$Format:%D$", however before this commit it would not be possible to build a release tarball that is not a git checkout (because git describe would fail) --- diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d39ea83 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/Makefile export-subst diff --git a/src/Makefile b/src/Makefile index ea72eb4..6748adf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -80,7 +80,7 @@ CC_WIN_64 := x86_64-w64-mingw32-gcc ## COMPTIME := $(shell date +%s) -VERSION_TAG := $(shell git describe --tags --dirty=+) +VERSION_TAG := $(shell git describe --tags --dirty=+ || echo '$Format:%D$'|sed -r 's/.* ([^ ]+$)/\1/') ## ## Compiler flags