rockbox/tools/genversion.sh

29 lines
900 B
Bash
Raw Normal View History

#!/bin/sh
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# Usage: genversion.sh destination-dir path-to-version.sh [source-root]
# Generate rbversion.h file
# XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD
VERSION=`$2 $3`
cat > "$1/_rbversion.h" << EOF
/* Generated by genversion.sh */
#define RBVERSION "$VERSION"
EOF
if [ -f "$1/rbversion.h" ]
then if diff "$1/_rbversion.h" "$1/rbversion.h" > /dev/null
then rm -f "$1/_rbversion.h"
else mv "$1/_rbversion.h" "$1/rbversion.h"
fi
else mv "$1/_rbversion.h" "$1/rbversion.h"
fi