summaryrefslogtreecommitdiffstats
path: root/tools/genversion.sh
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-28 04:07:57 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-28 04:07:57 +0000
commit10dbaa24a7c18d404e5ed34d93ec34c6b2f97b9c (patch)
treea4f4fc59cc8fbfa0f9cc31929bc2ce648fd3d150 /tools/genversion.sh
parent71cec646e6563dcf5190b4ece605cfe2e46be3fb (diff)
downloadrockbox-10dbaa24a7c18d404e5ed34d93ec34c6b2f97b9c.tar.gz
rockbox-10dbaa24a7c18d404e5ed34d93ec34c6b2f97b9c.tar.bz2
rockbox-10dbaa24a7c18d404e5ed34d93ec34c6b2f97b9c.zip
genversion: generate version.c and version.h independantly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26349 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/genversion.sh')
-rwxr-xr-xtools/genversion.sh43
1 files changed, 23 insertions, 20 deletions
diff --git a/tools/genversion.sh b/tools/genversion.sh
index cf8d999e5b..55abb5de3d 100755
--- a/tools/genversion.sh
+++ b/tools/genversion.sh
@@ -6,37 +6,40 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
-# Usage: genversion.sh destination-dir path-to-version.sh [source-root]
+# Usage: genversion.sh c/h destination-dir path-to-version.sh [source-root]
-# Generate version.[ch] files
+# Generate version.[ch] files (if first argument is c or h)
-VERSION=`$2 $3`
+# XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD
-cat > "$1/_version.h" << EOF
+VERSION=`$3 $4`
+
+if [ "$1" = "h" ]; then
+ cat > "$2/_version.h" << EOF
/* Generated by genversion.sh */
extern const char rbversion[];
#define RBVERSION "$VERSION"
EOF
-if [ -f "$1/version.h" ]
- then if diff "$1/_version.h" "$1/version.h" > /dev/null
- then mv "$1/_version.h" "$1/version.h"
- else rm -f "$1/_version.h"
+ if [ -f "$2/version.h" ]
+ then if diff "$2/_version.h" "$2/version.h" > /dev/null
+ then mv "$2/_version.h" "$2/version.h"
+ else rm -f "$2/_version.h"
+ fi
+ else mv "$2/_version.h" "$2/version.h"
fi
- else mv "$1/_version.h" "$1/version.h"
-fi
-
-
-cat > "$1/_version.c" << EOF
+elif [ "$1" = "c" ]; then
+ cat > "$2/_version.c" << EOF
/* Generated by genversion.sh */
-const char rbversion[] = "$VERSION";
+#include "version.h"
+const char rbversion[] = RBVERSION;
EOF
-if [ -f "$1/version.c" ]
- then if diff "$1/_version.c" "$1/version.c" > /dev/null
- then mv "$1/_version.c" "$1/version.c"
- else rm -f "$1/_version.c"
+ if [ -f "$2/version.c" ]
+ then if diff "$2/_version.c" "$2/version.c" > /dev/null
+ then mv "$2/_version.c" "$2/version.c"
+ else rm -f "$2/_version.c"
+ fi
+ else mv "$2/_version.c" "$2/version.c"
fi
- else mv "$1/_version.c" "$1/version.c"
fi
-