From e565e758763f32f49350b78b63308539cc0d90ab Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Wed, 16 Jan 2008 23:57:00 +0100 Subject: Some cleanup in the Makefile dependencies for subdirs Added target to create a generated version suffix file. --- buildutil/version-util | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'buildutil') 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 " && exit 1 + +VERS_FILE=$1 + +function createVers () +{ +cat < /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 -- cgit v1.2.3