summaryrefslogtreecommitdiff
path: root/buildutil
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-01-16 23:57:00 +0100
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2008-01-16 23:57:00 +0100
commite565e758763f32f49350b78b63308539cc0d90ab (patch)
tree5a44bcefc5710831cccc3aa9390080ee7070ea80 /buildutil
parent6601d4c8cfe062f61196ef6f4e2ade0156c3345c (diff)
downloadvdr-plugin-live-e565e758763f32f49350b78b63308539cc0d90ab.tar.gz
vdr-plugin-live-e565e758763f32f49350b78b63308539cc0d90ab.tar.bz2
Some cleanup in the Makefile dependencies for subdirs
Added target to create a generated version suffix file.
Diffstat (limited to 'buildutil')
-rwxr-xr-xbuildutil/version-util37
1 files changed, 35 insertions, 2 deletions
diff --git a/buildutil/version-util b/buildutil/version-util
index 7e377ab..cf2aa31 100755
--- a/buildutil/version-util
+++ b/buildutil/version-util
@@ -10,6 +10,23 @@
# An indication if localy modified files exist is added.
# -----------------------------------------------------------------------------
+[ $# -lt 1 ] && echo "USAGE: version-util <versionfile>" && exit 1
+
+VERS_FILE=$1
+
+function createVers ()
+{
+cat <<EOF
+/* ATTENTION: this file is automatically generated and will be overwritten!
+ * Manual changes will get lost!
+ */
+#ifndef GEN_VERSION_SUFFIX_H
+#define GEN_VERSION_SUFFIX_H
+#define VERSION_SUFFIX $1
+#endif
+EOF
+}
+
function cvsVers ()
{
d=`cvs log -r -N 2> /dev/null \
@@ -34,10 +51,26 @@ function gitVers ()
echo "_git_${b}_${h}"
}
+function checkVers ()
+{
+ s=`$1`
+ if [ ! -e ${VERS_FILE} ]; then
+ echo "$VERS_FILE does not exist! creating a new one."
+ createVers $s > ${VERS_FILE}
+ else
+ v=`grep '^#define VERSION_SUFFIX' ${VERS_FILE} \
+ | awk '{print $3}'`
+ if [ "$v" != "$s" ]; then
+ echo "$VERS_FILE is being recreated!"
+ createVers $s > ${VERS_FILE}
+ fi
+ fi
+}
+
if [ -d CVS ]; then
- cvsVers
+ checkVers cvsVers
fi
if [ -d .git ]; then
- gitVers
+ checkVers gitVers
fi