#!/bin/sh
#
#        Copyright(C) 1997 Network Flight Recorder, Inc.
#        All rights reserved.
#
#        Use and distribution of this software and its source code
#        are governed by the terms and conditions of the
#        Network Flight Recorder Software License ("LICENSE.TXT")
#
# By Mark Sienkiewicz / NFR
#


if [ -f NFR_ROOT ]
then
	nfr=`pwd`
	export nfr
	if ( . bin/select_sys )
	then
		echo include files selected
	else
		exit 1
	fi
else
	if [ "$nfr" = "" ]
	then
		nfr=`grep "^NFR=" Makefile | sed s/NFR=//`
	fi
	if [ "$nfr" = "" ]
	then
	  echo do not know NFR root - run fixmake at top of source tree
	  exit 1
	fi
fi
echo NFR source root = $nfr

find . -name Makefile.proto -print | (
	while read name
	do
		b=`echo $name | sed 's/.proto//' `
		echo $b
		echo '# automatically generated by fixmake'>$b
		echo NFR=$nfr >> $b
		cat $nfr/Makefile.include >>$b
		sed 's/^!/#/' < $b.proto >> $b
	done
	)
