A pure-C baseline ARM Cortex-M microcontroller development framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
915 B

#!/bin/sh
GVF=$1
APP=$2
DEF_VER=UNKNOWN
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f version
then
VN=$(cat version)
elif test -d .git
then
VN=$(git describe 2>/dev/null) && git update-index -q --refresh
HEAD=$(git rev-parse --verify --short HEAD 2>/dev/null)
if [ -n "$VN" ] ; then
VN="$VN-$HEAD"
else
VN="none-$HEAD"
fi
test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty"
else
VN="$DEF_VER"
fi
#VN=$(expr "$VN" : v*'\(.*\)')
echo "$VN"
if test -r $GVF
then
VC=$(grep SYSTEM_VERSION $GVF | sed -e 's/^#define SYSTEM_VERSION //')
VM=$(grep SYSTEM_APP $GVF | sed -e 's/^#define SYSTEM_APP //')
else
VC=unset
fi
if [ -n "$APP" ] ; then
APP="-$APP"
fi
test "\"$VN\"" = "$VC" -a "\"$APP\"" = "$VM" || {
echo "#define SYSTEM_VERSION \"$VN\"" >$GVF
echo "#define SYSTEM_APP \"$APP\"" >>$GVF
}