Update README.md
[mfgtools.git] / libuuu / gen_ver.sh
blob68e8436db71e3c61a4485917194169672fcfbde5
1 #!/bin/sh
3 # Input parameters
4 file_to_write="$1"
6 set -e
8 if [ -f ../.tarball-version ]
9 then
10 echo "#define GIT_VERSION \"lib$(cat ../.tarball-version)\"" > "$file_to_write"
11 exit 0
14 if [ "${APPVEYOR_BUILD_VERSION}" = "" ];
15 then
16 echo build not in appveyor
17 else
18 git tag -m"uuu ${APPVEYOR_BUILD_VERSION}" uuu_${APPVEYOR_BUILD_VERSION}
21 # Test if we are in a repo
22 if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ];
23 then
24 #echo "In a repo"
25 # Get the version of the last commit of the repo
26 version=`git describe --long`
27 echo "#define GIT_VERSION \"lib$version\"" > $file_to_write