#!/bin/sh
if [ $# = 2 ]
then
    if [ $2 = clean ]
    then
        make -f $PARTHENON/com/Makefile TARGET=$1 clean
        exit 0
    fi
fi
test=off
if [ $# != 4 ]
then
    if [ $# != 5 -o "$5" != test ]
    then
        echo "usage: auto <module_name> <result_tag> <foundry> <cell_library> [test]"
        echo "usage: auto <module_name> clean"
        echo "<result_tag> ::=  hsl | nld1 | nld2 | nld3 | nld4 | ps | tpm | glsh | lpr "
        echo "                |  v  |  gs  | interface"
        exit 1
    else
        test=on
    fi
fi
case $2 in
    glsh | lpr | v | gs | interface )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $2 ;;
    hsl )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.0$test ;;
    nld1 )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.1$test ;;
    nld2 )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.2$test ;;
    nld3 )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.3$test ;;
    nld4 )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.4$test ;;
    * )
        make -f $PARTHENON/com/Makefile TARGET=$1 FOUNDRY=$3 CELL_LIB_NAME=$4 PARTHEN=$PARTHENON TEST=$test $1.$2 ;;
esac
