File: mkversion.sh

package info (click to toggle)
swi-prolog 6.6.6-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 82,312 kB
  • sloc: ansic: 322,250; perl: 245,822; sh: 6,651; java: 5,254; makefile: 4,423; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (29 lines) | stat: -rwxr-xr-x 711 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

cat >> version.h.new <<_EOM_
/*  Generated file that contains the version identifier from
    the "git describe" command.

    DO NOT EDIT.   Check Makefile and mkversion.sh in src.
*/

_EOM_

gitversion=''
if v=`git describe --match 'V*' 2>/dev/null`; then
    if [ ! -z $v ]; then
	gitversion=`echo $v | sed 's/^V//'`
	if [ `git diff | wc -c` != 0 ]; then gitversion="$gitversion-DIRTY"; fi
	echo "#define GIT_VERSION "'"'$gitversion'"' >> version.h.new
    fi
fi

if [ ! -r version.h ]; then
    mv version.h.new version.h
elif cmp version.h version.h.new >/dev/null; then
    echo "No GIT version change"
    rm version.h.new
else
    echo "Updated GIT version"
    mv version.h.new version.h
fi