3
if [ ${#} -eq 1 ] && [ "x$1" = "x-r" ]; then
10
if ! `(git status | grep -q "On branch") 2> /dev/null`; then
11
# If we don't have git, we can't work out what
12
# version this is. It must have been downloaded as a
13
# zip file. Github creates the zip file with all
14
# files dated from the last change: use the
15
# Makefile's modification time as a release number
16
release=zip-`stat -c "%y" Makefile | sed 's/ .*//'`
19
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
20
# generate the version info based on the tag
21
release=`(git describe --tags || git --describe || git describe --all --long) \
22
2>/dev/null | tr -d '\n'`
24
# Are there uncommitted changes?
25
git update-index --refresh --unmerged > /dev/null
26
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
28
release="$release-dirty"
33
if [ $QUIET -ne 1 ]; then
34
printf "#ifndef _VERSION_H_ \n"
35
printf "#define _VERSION_H_ \n\n"
36
printf "#define VERSION \"$release\"\n"