btstack/tool/get_version.sh
2015-11-13 09:36:05 +01:00

16 lines
593 B
Bash
Executable File

#!/bin/sh
DIR=`dirname $0`
FILE=$DIR/../src/version.h
COMMIT=`git log -1 --pretty=format:%h`
MAJOR=0
MINOR=9
DATE=`date "+%Y-%m-%d_%H:%M:%S"`
printf "// BTstack - version.h\n" > $FILE
printf "// - generated by %s\n" $0>> $FILE
printf "// - at %s\n" $DATE >> $FILE
printf "#define BTSTACK_MAJOR %u\n" $MAJOR >> $FILE
printf "#define BTSTACK_MINOR %u\n" $MINOR >> $FILE
printf "#define BTSTACK_COMMIT \"%s\"\n" $COMMIT >> $FILE
printf "#define BTSTACK_VERSION \"%u.%u-%s\"\n" $MAJOR $MINOR $COMMIT >> $FILE
printf "#define BTSTACK_DATE \"%s\"\n" $DATE >> $FILE