Liam Girdwood | b14e852 | 2018-01-10 17:36:41 +0000 | [diff] [blame^] | 1 | |
| 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 |
| 7 | if [ $# -eq 0 ]; then |
| 8 | DIR=`pwd` |
| 9 | else |
| 10 | DIR=$1 |
| 11 | fi |
| 12 | |
| 13 | # create git version if we are a git repo |
| 14 | if [ ! -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 |
| 21 | else |
| 22 | echo "#define REEF_TAG 0" > $DIR/src/include/version.h |
| 23 | fi |
| 24 | |
| 25 | # build counter |
| 26 | if [ -e $DIR/.build ]; then |
| 27 | num=$((`cat $DIR/.build` + 1)) |
| 28 | else |
| 29 | num=0 |
| 30 | fi |
| 31 | |
| 32 | # save and insert build counter |
| 33 | echo $num > $DIR/.build |
| 34 | echo "#define REEF_BUILD $num" >> $DIR/src/include/version.h |
| 35 | |
| 36 | #echo version for AC_INIT |
| 37 | if [ -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` |
| 39 | fi |