
# Note - important blank line on top of file - prevents csh problems

# create all of the S functions
# use $M/infun.list to determine which are internal, which external
# use $M/stop.list to determine things that shouldn't be made for this version

cd $F
find . -type d -print |
	sed -e '/\.$/d' -e '/RCS$/d' -e 's/..//'|
	sort >/tmp/extfuns	# directories in $F
ls -d *lib*| sort -u - $M/stop.list >/tmp/stopfuns	# add libs to stop list
comm -23 /tmp/extfuns /tmp/stopfuns >/tmp/allfuns	# omit stop list fns

# create support libraries first
for i in `ls -d $F/*lib*`
do
	cd $i
	MAKE || exit 1
done

# make internal function stuff so that error messages will appear now
comm -23 $M/infun.list /tmp/stopfuns >/tmp/infuns
for i in `cat /tmp/infuns`
do
	cd $F/$i
	MAKE internal || exit 1
done

#compile and load the external ones
comm -23 /tmp/allfuns $M/infun.list >/tmp/extfuns
for i in `cat /tmp/extfuns`
do
	cd $F/$i
	MAKE || exit 1
done

#now install externals -- make sure all compilations/loads successful first
for i in `cat /tmp/extfuns`
do
	cd $F/$i
	INSTALLIT
done
rm -f /tmp/*funs >/dev/null 2>&1
