blob: fb5f3e4c0fafed895b9aa2489f4beac36b625ff7 [file] [log] [blame]
Liam Girdwoodb14e8522018-01-10 17:36:41 +00001
2# version for configure, make dist and FW etc
3# usage "version.sh dir"
4# Where dir is the top level directory path.
5
6# use pwd is no path argument is given
7if [ $# -eq 0 ]; then
8 DIR=`pwd`
9else
10 DIR=$1
11fi
12
13# create git version if we are a git repo
14if [ ! -d $DIR/.git ]; then
15# version for make dist
16 git describe --abbrev=4 > $DIR/.version
17 git describe --abbrev=4 > $DIR/.tarball-version
18
19 # git commit for IPC
20 echo "#define REEF_TAG \"`git log --pretty=format:\"%h\" -1 | cut -c1-5`\"" > $DIR/src/include/version.h
21else
22 echo "#define REEF_TAG 0" > $DIR/src/include/version.h
23fi
24
25# build counter
26if [ -e $DIR/.build ]; then
27 num=$((`cat $DIR/.build` + 1))
28else
29 num=0
30fi
31
32# save and insert build counter
33echo $num > $DIR/.build
34echo "#define REEF_BUILD $num" >> $DIR/src/include/version.h
35
36#echo version for AC_INIT
37if [ -e $DIR/.version ]; then
38 echo -n `cat $DIR/.version | cut -dv -f2 | cut -d. -f1`.`cat $DIR/.version | cut -d. -f2 | cut -d- -f1`
39fi