#!/bin/sh
MANDIR=debian/mans
mkdir -p $MANDIR

VERSION=`dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/[+~]dfsg$//'`
NAME=`grep "^Description:" debian/control | sed 's/^Description: *//' | head -n1`
PROGNAME=`grep "^Package:" debian/control | sed 's/^Package: *//'`

AUTHOR=".SH AUTHOR\nThis manpage was written by $DEBFULLNAME for the Debian distribution and
can be used for any other usage of the program.
"

progname=mapsembler2_extremities
help2man --no-info --no-discard-stderr --help-option=" " \
         --name="performs the first step of Mapsembler2_extend" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=mapsembler_extend
help2man --no-info --no-discard-stderr --help-option=" " \
         --name="extends a DNA sequence of interest given a set of reads, by computing a targeted micro assembly" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=mapsembler2_kissreads
help2man --no-info --no-discard-stderr --help-option=" " \
         --name="Checks for each sequence contained into the toCheck.fasta if it is read coherent with reads from readsA.fasta or readsB.fasta" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=mapsembler2_kissreads_graph
help2man --no-info --no-discard-stderr --help-option=" " \
         --name="maps the provided reads on the graph" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=run_mapsembler2_pipeline
help2man --no-info --no-discard-stderr --help-option=" " \
         --name="pipelines the mapsembler2 tools" \
            --version-string="$VERSION" ${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

echo "$MANDIR/*.1" > debian/manpages

cat <<EOT
Please enhance the help2man output.
The following web page might be helpful in doing so:
    http://liw.fi/manpages/
EOT
