5 if test $# -ne 1 -a $# -ne 2
7 echo "Usage: "`basename "$0"`" <file> [define_name]"
12 TEMP_FILE
="${OUTPUT_FILE}.tmp"
23 SVNVERSION
=`svnversion`
27 git status
>/dev
/null
# updates dirty state
28 SVNVERSION
=`git show | grep '^ *git-svn-id:' | sed 's/.*@\([0-9]*\) .*/\1/'`
31 test -z "$(git diff-index --name-only HEAD)" || SVNVERSION
="${SVNVERSION}M"
33 SVNVERSION
=0+`git rev-parse HEAD`
34 test -z "$(git diff-index --name-only HEAD)" || SVNVERSION
="${SVNVERSION}-dirty"
39 if test -z ${SVNVERSION}
44 echo "#define ${DEFINE} \"${SVNVERSION}\"" > ${TEMP_FILE}
45 if test ! -f ${OUTPUT_FILE}
47 echo "Generated
${OUTPUT_FILE}"
48 cp ${TEMP_FILE} ${OUTPUT_FILE}
49 if test $? -ne 0; then exit 1; fi
51 if ! cmp -s ${OUTPUT_FILE} ${TEMP_FILE}
52 then echo "Regenerated
${OUTPUT_FILE}"
53 cp ${TEMP_FILE} ${OUTPUT_FILE}
54 if test $? -ne 0; then exit 1; fi