ROOT=/; export ROOT
HERE=`pwd`

NEEDED_DIR="/bsd /etc /lib /usr /usr/lib"
echo "\n===== Checking directories...\n"
if [ ! -d  "$ROOT" ]; then
	mkdir $ROOT$DIR > /dev/null 2>&1
fi
for DIR in `echo $NEEDED_DIR`; do
	if [ ! -d  "$ROOT$DIR" ]; then
		mkdir $ROOT$DIR
	fi
done

echo "\n===== Making include\n"

if ns32000; then	
	echo "cd $HERE/include_ns32"
	cd $HERE/include_ns32; make ROOT=$ROOT
elif m88k; then
	echo "cd $HERE/include_m88k"
	cd $HERE/include_m88k; make ROOT=$ROOT
else
	echo "Sorry, can't make include for this processor"
fi


echo "\n===== Making TCP libs\n"
if ns32000; then	
	cd $HERE/lib/libbsd_ns32; make clobber ROOT=$ROOT
	cd $HERE/lib/libbsd_ns32; make ROOT=$ROOT
	cd $HERE/lib/libbsd_ns32; make install ROOT=$ROOT
elif m88k; then
	cd $HERE/lib/libbsd_m88k; make clobber ROOT=$ROOT
	cd $HERE/lib/libbsd_m88k; make ROOT=$ROOT
	cd $HERE/lib/libbsd_m88k; make install ROOT=$ROOT
else
	echo "Sorry, can't make libbsd for this processor"
fi
cd $HERE/lib/libdbm; make clobber ROOT=$ROOT
cd $HERE/lib/libdbm; make ROOT=$ROOT
cd $HERE/lib/libdbm; make install ROOT=$ROOT

echo "\n===== Making NFS libs\n"
cd $HERE/lib/libyp; make -f libyp.mk clobber ROOT=$ROOT
cd $HERE/lib/libyp; make -f libyp.mk ROOT=$ROOT
cd $HERE/lib/libyp; make -f libyp.mk install ROOT=$ROOT
cd $HERE/lib/librpc; make -f librpc.mk clobber ROOT=$ROOT
cd $HERE/lib/librpc; make -f librpc.mk ROOT=$ROOT
cd $HERE/lib/librpc; make -f librpc.mk install ROOT=$ROOT
cd $HERE/lib/librpcsvc; make -f librpcsvc.mk clobber ROOT=$ROOT
cd $HERE/lib/librpcsvc; make -f librpcsvc.mk ROOT=$ROOT
cd $HERE/lib/librpcsvc; make -f librpcsvc.mk install ROOT=$ROOT

