File: mkversion

package info (click to toggle)
xwax 0.9-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 420 kB
  • sloc: ansic: 4,215; makefile: 263; sh: 124
file content (31 lines) | stat: -rwxr-xr-x 577 bytes parent folder | download | duplicates (8)
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
30
31
#!/bin/sh
#
# Generate version information from Git for use in a Makefile
#
# Output the current version number so it can be assigned to a
# variable, and touch a file which can be used as a dependency.
#

VF=.version

if [ "$1" = "-r" ]; then
	# Refresh the version number, if we can

	VERSION=`git describe 2> /dev/null`
	if [ $? -eq 0 ]; then
		if ! echo $VERSION | diff - $VF > /dev/null 2>&1; then
			echo $VERSION > $VF
		fi
	fi
else
	# Output the version number

	if [ ! -r $VF ]; then
		echo "$0: Version number is not known" >&2
		exit 1
	fi

	cat .version
fi

exit 0