Doom plugin: Missed properly making a few 'unsigned' on my second pass.
[maemo-rb.git] / tools / genversion.sh
blob55abb5de3db09ef7b037129acbdf5a5d899cd8ea
1 #!/bin/sh
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
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
15 VERSION=`$3 $4`
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"
22 EOF
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 */
34 #include "version.h"
35 const char rbversion[] = RBVERSION;
36 EOF
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"