#! /bin/sh

#
# $Header: /home/gene/src/lisp-script/RCS/make-clean,v 1.1 2004/03/24 06:35:06 gene Exp $
#
# Copyright (C) 2001  Gene Michael Stover.  All rights reserved.
# 
# This library is free software; you can redistribute it
# and/or modify it under the terms of version 2.1 of the GNU
# General Public License as published by the Free
# Software Foundation.
# 
# This library is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more
# details.
# 
# You should have received a copy of the GNU General
# Public License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
# 

RC=0
NAME=lisp

if test x$1 = x-h || test x$1 = x-help; then
    echo Usage: make-clean \[clean \| distclean \| mostlyclean \| maintainer-clean\]
else
    if test x$1 = xmaintainer-clean; then
        echo "       " rm gmon.out Makefile config.status
        rm gmon.out Makefile config.status
	rm -r doc/${NAME}
	rm doc/${NAME}.dvi
    fi
    if test x$1 = xmaintainer-clean || \
       test x$1 = xdistclean
    then
        for A in src/config.h config.log config.status; do
            if test -f $A; then
                echo "       " rm $A
                rm $A
            fi
        done
        find . -name "*~" -exec echo "       " rm {} \; -exec rm {} \;
	rm doc/${NAME}.toc
        rm doc/${NAME}.aux
    fi
    if test x$1 = xmaintainer-clean || \
       test x$1 = xdistclean || \
       test x$1 = xclean || test -z "$1"
    then
        for A in lib/*; do
            if test -f $A; then
                echo "       " rm $A
                rm $A
            fi
        done
        for A in bin/test???? bin/demo????; do
            if test -e src/$A*; then
                echo "       " rm $A
                rm $A
            fi
        done
    fi
    if test x$1 = xmaintainer-clean || \
       test x$1 = xdistclean || \
       test x$1 = xclean || test -z "$1" || \
       test x$1 = xmostlyclean
    then
        find . -name SunWS_cache -exec "    " rm -r {} \; -exec rm {} \;
        find tmp -type f -exec echo "    " rm {} \; -exec rm {} \;
        find . -name "*.o" -exec echo "       " rm {} \; -exec rm {} \;
	rm doc/${NAME}.log
    else
        echo Unexpected command line option, \"$1\".
        RC=1
    fi
fi

exit $RC

# --- end of file ---
