#!/bin/sh

echo -n "SRCS=" > ./Makefile.inc
FIRST=1

LS=`ls *.c 2>/dev/null | wc -l `
if [ "0" == "$LS" ] ; then
  echo "*** no modules found"
else
	for oldfile in *.c
	do
		if [ "$FIRST" = 1 ] ; then
			echo -n " "$oldfile >> ./Makefile.inc
		else
			echo "\\" >> ./Makefile.inc
			echo -n "     " $oldfile >> ./Makefile.inc
		fi
		FIRST=0
	done
fi

echo "" >> ./Makefile.inc

echo -n "SUBS=" >> ./Makefile.inc
FIRST=1
for dir in *
do
        if [ -d $dir ] ; then
		if [ -f $dir/Makefile ] ; then
			if [ "$FIRST" = 1 ] ; then
				echo -n " "$dir >> ./Makefile.inc
		        else
				echo "\\" >> ./Makefile.inc
				echo -n "     " $dir >> ./Makefile.inc
			fi
			FIRST=0
			if [ -f $dir/configure ] ; then
				$dir/configure
			fi
		fi
	fi
done

exit 0

