#!/bin/sh

package=lib1305
namespace=lib1305

mkdir -p doc/man

pandoc --standalone --to man --metadata title=$namespace --metadata section=3 < doc/api.md | sed 's/^    //' > doc/man/$namespace.3
touch -r doc/api.md doc/man/$namespace.3
for alias in _verify
do
  rm -f doc/man/$namespace"$alias".3
  ln -s $namespace.3 doc/man/$namespace"$alias".3
done

for cmd in fulltest test speed
do
  pandoc --standalone --to man --metadata title=${package}-${cmd} --metadata section=1 < doc/${package}-${cmd}.md | sed 's/^    //' > doc/man/${package}-${cmd}.1
  touch -r doc/${package}-${cmd}.md doc/man/${package}-${cmd}.1
done
