22 lines
512 B
Bash
22 lines
512 B
Bash
#!/bin/sh
|
|
|
|
createVersion() {
|
|
local gitVersion=`git describe --long --always --dirty`
|
|
local versionLoc="../src/version.h"
|
|
local currentVersion=$(grep -oP '"\K.*(?=")' $versionLoc 2>/dev/null)
|
|
|
|
if [ ! -z "$1" ] && [ "$1" == "-d" ]; then
|
|
gitVersion="${gitVersion}-debug"
|
|
fi
|
|
if [ "$gitVersion" == "$currentVersion" ]; then
|
|
return 0
|
|
else
|
|
echo "Creating version header: ${gitVersion}"
|
|
cat <<VERSION_END > "$versionLoc"
|
|
#define GITVERSION "${gitVersion}"
|
|
VERSION_END
|
|
fi
|
|
}
|
|
|
|
createVersion $*
|