#!/bin/csh -f
#Usage: fix_for_no_ranlib dstool_val top_makefile_locn calling_script_name

#The value of dstool_val will be the same as $DSTOOL in the calling script.

#The value of top_makefile_locn will typically be either $DSTOOL/src or
#the root director of the user dstool heirarchy.

#The possible values of calling_script_name are:
#	install_dstool and install_dsuser

if ($3 == "install_dstool") then
	goto FOR_INSTALL_DSTOOL
else if ($3 == "install_dsuser") then
	goto FOR_INSTALL_DSUSER
else
	echo "fix_for_no_ranlib: Unknown second argument, exiting ..."
	goto BAD_EXIT
endif
endif

FOR_INSTALL_DSTOOL:

if ( ! (-d $1) ) then
	echo "fix_for_no_ranlib: Incorrect directory location, exiting ..."
	goto BAD_EXIT
else
	echo "Removing ranlib references in: "
	echo " src/Makefile..."
endif

cd $1/src

mv -f Makefile Makefile.tmp

sed '/ranlib/d' Makefile.tmp > Makefile

rm -f Makefile.tmp

exit(0)



FOR_INSTALL_DSUSER:

if ( ! (-d $1) ) then
	echo "fix_for_no_ranlib: Incorrect directory location, exiting ..."
	goto BAD_EXIT
else
	echo "Removing RANLIB references in: "
	echo " Makefile..."
endif

cd $2

mv -f Makefile Makefile.tmp

sed '/ranlib/d' Makefile.tmp > Makefile

rm -f Makefile.tmp



BAD_EXIT:
	exit(1)
