#!/bin/sh
#
# COPYRIGHT (c) 2025 The Fellowship of SML/NJ (https://smlnj.org)
# All rights reserved.
#
# helper script for copying the SML/NJ documentation to a public place.
#
# usage:
#	copy-doc <dst>
#
#	<dst>	Path to the installation destination. For example: /usr/local/smlnj
#

# get the destination path
#
if [ $# != 1 ] ; then
  exit 1
fi

DST="$1"
cd "$DST" || exit 1

MANDIR="$DST/../share/man"	# e.g., /usr/local/share/man

if test -d "$MANDIR" -a -d doc/man ; then
#
# copy manual pages to their location
#
  cd doc/man || exit 1
  for d in man* ; do
    mkdir -p "$MANDIR/$d" || exit 1
    cp -p $d/* "$MANDIR/$d/"
  done
fi

#
# TODO: copy other documentation to $DST/../doc/smlnj/
#

exit 0
