File: mkversion

package info (click to toggle)
xwax 1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 576 kB
  • sloc: ansic: 6,687; sh: 170; makefile: 142
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