#!/bin/sh

VERSION=$(cat ../VERSION)
DATE=$(grep ^D ../manifest | cut -c 3-12)
TIME=$(grep ^D ../manifest | cut -c 14-21)
YEAR=$(grep ^D ../manifest | cut -c 3-6)
HASH=$(cut -c -10 < ../manifest.uuid)

echo "@set VERSION" $VERSION > version.texi
echo "@set DATE" $DATE >> version.texi
echo "@set TIME" $TIME >> version.texi
echo "@set YEAR" $YEAR >> version.texi
echo "@set HASH" $HASH >> version.texi

# Date and version only for the man pages (no time or hash), in the
# same form GNU coreutils uses in the .TH footer.
cat > version.man <<END
.\\" Generated by mkversion from the Fossil manifest; do not edit.
.ds Md $DATE
.ds Mv $VERSION
END
