]> rtime.felk.cvut.cz Git - jailhouse.git/blob - scripts/gen_version_h
core/driver: Add version information
[jailhouse.git] / scripts / gen_version_h
1 #!/bin/sh
2 #
3 # Jailhouse, a Linux-based partitioning hypervisor
4 #
5 # Copyright (c) Siemens AG, 2014
6 #
7 # Authors:
8 #  Jan Kiszka <jan.kiszka@siemens.com>
9 #
10 # This work is licensed under the terms of the GNU GPL, version 2.  See
11 # the COPYING file in the top-level directory.
12 #
13
14 echo -e "/* Auto-generated - leave alone and don't commit! */\n"
15
16 if ! git rev-parse 2>/dev/null; then
17         version="`cat $1/VERSION`"
18 else
19         cd $1 > /dev/null
20         git diff > diff.log
21         describe="`git describe --long --dirty --match "v[0-9].[0-9]*"`"
22         version="`echo $describe | sed -e 's/\([^-]*\)-\(.*\)/\1 (\2)/'`"
23         cd - > /dev/null
24 fi
25
26 echo "#define JAILHOUSE_VERSION \"$version\""