#!/bin/sh
if test $# -ge 2 -o "$1" = "-help"
then
    echo "usage: $0 [all]";
    echo "purpose: clean source code [and ug libraries]";
    echo "Options are";
	echo " all: clean all ug libraries, too";
    exit 1;
fi

if test "x$UGROOT" = "x"
then
    echo "$0: to use $0 set shell environment variable UGROOT!";
    exit 1;
fi

ugmake ug -i -k clean
ugmake sc -i -k clean
ugmake sc2d -i -k clean
ugmake sc3d -i -k clean
ugmake simple -i -k clean
ugmake diff2d -i -k clean
ugmake diff2da -i -k clean
ugmake fe -i -k clean
ugmake ns -i -k clean
ugmake ns2d -i -k clean
ugmake ns3d -i -k clean
ugmake tools -i -k clean

if test "$1" = "all"
then
	rm -f $UGROOT/lib/*.a
	rm -f $UGROOT/bin/xugv
	rm -f $UGROOT/bin/m2ps
	rm -f $UGROOT/../*/pclib/*.a
	rm -f -r $UGROOT/include
	ugmake tools -i -k clean
fi

