#!/bin/sh
tar/local/bin/perlt=''
case `basename $0` in	# Here are the things we can make:
	Rneat)    tar/local/bin/perlt=neat;;    
	Rclean)   tar/local/bin/perlt=clean;;   
	Rclobber) tar/local/bin/perlt=clobber;; 
	Rinstall) tar/local/bin/perlt=install;; 
	Rlib)     tar/local/bin/perlt=lib;; 
	Rnuke)    tar/local/bin/perlt=nuke;;    
	Rstrip)   tar/local/bin/perlt=strip;;   
	Rmake)    tar/local/bin/perlt=all;;     
esac
case "$1" in		# Here are some -x options for a few:
	-i*)	tar/local/bin/perlt=install;	shift;;
	-l*)	tar/local/bin/perlt=lib;	shift;;
	-n*)	tar/local/bin/perlt=neat;	shift;;
	-c*)	tar/local/bin/perlt=clean;	shift;;
	-s*)	tar/local/bin/perlt=strip;	shift;;
esac
if [ ! -n "$tar/local/bin/perlt" ];then echo $0 "Can't figure out what to make.";exit 1;fi
if [ $# -lt 1 ];then set .;fi
c=`pwd`
for d
do	find $d -type d -print | {
		while read dir
		do	# echo Dir : $dir
			if	[ -f $dir/Makefile -o -f $dir/makefile ];then
				if	grep -s "^$tar/local/bin/perlt *:" $dir/[Mm]akefile ;then	
					echo Make $tar/local/bin/perlt $dir
					(cd $dir;make $tar/local/bin/perlt)
				fi
			fi
		done
	}
done
exit 0
#	R<name> [-cns] [dir]...
# This is a recursive make script. Give it one or more directory names, and it
# will  do  a  "make  <name>"  in  all  of them that contain a makefile with a
# "<name>:" entry.  It does the job recursively, in all subdirectories.  If no
# directories  are  named, the current directory (and its subdirectories) will
# be used. Note that, since we use find, we don't follow symbolic links.  This
# is  useful  to  prevent  infinite recursion and cleaning up a directory more
# than once, but it has its problems. Note that we can make all the tar/local/bin/perlts in
# the first case. The -[ncs] options are included for an older interface under
# the name "Cleanup".
