blob: 4f25ecd0b5416745b4b3f61ae5955d5f5ba6b114 [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
Liam Girdwood83fec152018-01-11 12:10:03 +000013# create git version if we are a git repo or git worktree
14if [ -e $DIR/.git -o -d $DIR/.git ]; then
Liam Girdwoodb14e8522018-01-10 17:36:41 +000015# 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
Liam Girdwood83fec152018-01-11 12:10:03 +000022 echo "#define REEF_TAG \"0\"" > $DIR/src/include/version.h
Liam Girdwoodb14e8522018-01-10 17:36:41 +000023fi
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
Liam Girdwood93d62e52018-01-10 20:26:08 +000038 echo -n `cat $DIR/.version | cut -dv -f2 | cut -d. -f1`.`cat $DIR/.version | cut -d. -f2 | cut -d- -f1`.`cat $DIR/.version | cut -d. -f3 | cut -d- -f1`
Liam Girdwoodb14e8522018-01-10 17:36:41 +000039fi