#! /bin/sh
#
#  $Id$
#

basedir=$1
shift
public_docs="user develenv ka9q posix_users"
support_docs="hppa1_1 i386 i960 m68k sparc newlib gcc"
partners_docs="posix1003.1 posix1003.1h"
oar_manuals="ada_user hwapi powerpc tools/texi2www"

# relnotes  is obsolete
# posix_users manual left out until finished
# ada_user manual left out until bindings released

if [ x${MANUAL_SET} = x ] ; then
  MANUAL_SET=public
fi

case ${MANUAL_SET} in
  public)
    manuals="$public_docs"
    ;;
  support)
    manuals="$public_docs $support_docs"
    ;;
  partners)
    manuals="$public_docs $support_docs $partners_docs"
    ;;
  internal)
    manuals="$public_docs $support_docs $partners_docs $oar_manuals"
    ;;
  *)
    echo "ERROR: Unknown manual set ${MANUAL_SET}"
    exit 1
    ;;
esac

for action in $*
do
  for manual in $manuals
  do
    if [ x${TEST} = xyes ] ; then
        echo "TEST *** make $action on ${basedir}/${manual} ***"
    else
        echo
        echo "*** make $action on ${basedir}/${manual} ***"
        echo
        cd ${basedir}/${manual}
        gmake $action || exit $?
    fi
  done
done

exit 0
