3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 # Usage: genversion.sh c/h destination-dir path-to-version.sh [source-root]
11 # Generate version.[ch] files (if first argument is c or h)
13 # XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD
17 if [ "$1" = "h" ]; then
18 cat > "$2/_version.h" << EOF
19 /* Generated by genversion.sh */
20 extern const char rbversion[];
21 #define RBVERSION "$VERSION"
24 if [ -f "$2/version.h" ]
25 then if diff "$2/_version.h" "$2/version.h" > /dev
/null
26 then mv "$2/_version.h" "$2/version.h"
27 else rm -f "$2/_version.h"
29 else mv "$2/_version.h" "$2/version.h"
31 elif [ "$1" = "c" ]; then
32 cat > "$2/_version.c" << EOF
33 /* Generated by genversion.sh */
35 const char rbversion[] = RBVERSION;
38 if [ -f "$2/version.c" ]
39 then if diff "$2/_version.c" "$2/version.c" > /dev
/null
40 then mv "$2/_version.c" "$2/version.c"
41 else rm -f "$2/_version.c"
43 else mv "$2/_version.c" "$2/version.c"