#!/bin/sh
#     Shell Name: changeAllMake
#     Created Date: Dec 22,1999
#     Description: This shell is used to modify the Makefile of the Fortran DCL Library.
#                  The usage of this shell is that you should give the source path of the 
#                  DCL src folder. that is, 
#                       changeAllMake  ./src
#

echo "-- Start --"
curpath=$1
TMPFILE=tmp.makefile
MAKEFILE=Makefile
MV="/bin/mv -f"

cd $curpath
echo "Current path is: "$curpath

files=`ls`
for FILE in $files
do
	if test -d $FILE 
	then
		echo "cd $curpath/$FILE"
		cd "./$FILE"
		files2=`ls`
		for FILE2 in $files2
		do
			if test -d $FILE2
			then
				echo "cd $curpath/$FILE/$FILE2"
				cd "./$FILE2"
				echo "Now process : `pwd`"
				/bin/sed -e 's/\.f/.c/g' -e 's/LIBFSRCS/zhuzy1/' -e 's/LIBCSRCS/LIBFSRCS/' -e 's/zhuzy1/LIBCSRCS/' -e 's/LIBFOBJS/zhuzy2/' -e 's/LIBCOBJS/LIBFOBJS/'  -e 's/zhuzy2/LIBCOBJS/' $MAKEFILE > $TMPFILE
				$MV $TMPFILE $MAKEFILE
				echo "mdMake Makefile......"
				mdMake
				cd ..
			fi
		done
		cd ..
	fi
done
cd ..
echo "-- Finish --"
