opath=$PATH
PATH=/bin:/usr/bin:/etc:/usr/lib:/usr/lib/uucp

arg=-test
case $1 in
	-test) arg=-test ;;
	-cmp)	arg=-cmp ;;
	-cp)	arg=-cp ;;
esac

# make the binaries for cmds that are from single files of source code

for i in *.[csy]
do
	s=.c
	case $i in
	*.y)	s=.y ;;
	*.s)	s=.s ;;
	esac
	dest=`basename $i $s`
	for j in /bin /usr/bin /etc /usr/lib
        do
		test -f $j/$dest && continue 2
	done
	echo need to make and install $i
done

# make the binaries for cmds whose source is in a directory

case $arg in
-test)	arg=-cmp ;;
-cmp)	arg=-cmp ;;
-cp)	arg=-cp ;;
esac
for i in adb as awk cpp ditroff dc eqn fgg learn lex lint m4 make neqn\
         pcc plot prep ratfor refer roff sed sh spell struct tar tbl \
         tp troff tset uucp xsend yacc
	 do
	 	for dir in /bin /usr/bin /etc /usr/lib
		do
			test -f $i/$dest && echo $i/$dest && continue 2
		done
		echo need to make $dir/$i
done
