rockbox/tools/genversion.sh
Amaury Pouly 50c1de7092 Fix makefile not rebuilding rbversion.h in some cases
For example when running make VERSION="bla"

Change-Id: I8f8833f0fb200828346ed0a6842a9340e3653932
2016-09-23 23:03:23 +02:00

29 lines
945 B
Bash
Executable file

#!/bin/sh
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# Usage: genversion.sh destination-dir version
# Generate rbversion.h file
# XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD
VERSION="$2"
cat > "$1/_rbversion.h" << EOF
/* Generated by genversion.sh */
#define RBVERSION "$VERSION"
EOF
# Don't touch rbversion.h if it hasn't change, to avoid rebuilding stuff
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