PAGES=0-9999
TERM=ansi
TARGET=
PRETTY="TXTPRG=kroff -T hpam"
OPTIONS=
MAKE_TEXT=$SCRIPTS/makefile.txt
LOCL_MAKE=makefile.txt
PROG="\007tmake "
BADTAR="<unknown target> "
BADOPT="<unknown option> "
H="
==========
$PROG [-options] [file(s) || target(s)]
==========
invokes make with general scripts for text processing.
==========
TARGETS
==========
bb      bibliography (sources cited)
lt      list of texts (to testlist.log)
ma      write model makefile to local directory
pr      problems (problems.log)
to      text only
tb      text and bibliography (sources cited)
wb      whole bibliography
==========
OPTIONS
==========
-td     (dumb) line printer output
-th     hp think-jet ouput (default)
-lj     hp laser jet output
-lu     hp laser jet output (underline for double column print)
-tr     terminal (raw) output
-tx     xerox 3700 laser output
-x      diagnostic mode
-o list list of pages to print
==========
RELATED FILES
==========
$(SCRIPTS)/makefile.txt    		general definitions
./makefile.txt					local definitions
==========
BUGS
==========
*		interruptions may leave work files that prevent the next
		stage from being properly executed.
==========
"
case $1 in
    -h|help|hint)   echo "$H" | more; exit 0;;
esac
while   :
do
    case $1 in
        wb)     TARGET="$TARGET wholebibl.tmp";;
        tb)     TARGET="$TARGET textbibl.tmp";;
        bb)     TARGET="$TARGET bibl.tmp";;
        lt)     TARGET="$TARGET textlist.log";;
        pr)     TARGET="$TARGET problem.log";;
		ma)		TARGET="$TARGET makefile.txt";;
        to)     TARGET="$TARGET text.tmp";;
        [a-z]*) echo "$PROG $BADTAR $1"; exit 69;;
        -th)    TERM=hp;PRETTY="kroff";;
        -lj)    TERM=hpl;PRETTY="kroff";;
        -lu)    TERM=hplu;PRETTY="kroff";;
        -td)    TERM=dumb;PRETTY="kroff";;
        -tx)    TERM=xerox;PRETTY="kroff";;
        -o)     shift;PAGES=$1;;
        -x)     set -x;;
        -v)     set -v;;
        -n)     OPTIONS="$OPTIONS $1";;
        -[a-z]*) echo "$PROG $BADOPT $1"; exit 69;;
    esac
    case $# in
        0)  break;;
        1)  break;;
        *)  shift;;
    esac
done
:
case $TARGET in
    "") TARGET="textbibl.tmp";;
    *)  ;;
esac
:
if test ! -r $LOCL_MAKE
then
echo "($0) <cannnot find> $LOCL_MAKE"
TARGET=makefile.txt
make "TXTPRG=$PRETTY" $OPTIONS -f $MAKE_TEXT $TARGET\
    TERM=$TERM PAGES=$PAGES
exit
fi
:
make "TXTPRG=$PRETTY" $OPTIONS -f $MAKE_TEXT -f $LOCL_MAKE $TARGET\
    TERM=$TERM PAGES=$PAGES
:
case $? in
	0)	echo "($0) <successful termination>";;
	*)	echo "($0) <make returned error>";
		rm -i *.tmp;;
esac
