
# This script mcs's and strips all executable files in the file $FILE.
# Redirect the output to some LOG file.

REL=$1
MASTER1=/usr/src/local/release/master.list
MASTER2=/usr/src/local/release/master.rel

if [ ! "$REL" ]; then
	echo "usage: $0 RELNAME/GROUP"
	exit 1
fi

cd /
IFS="
"
LIST1=`grep "[ 	].*${REL}[ 	].*" $MASTER1 | grep -v "d--" | awk '{ print $1 }' | egrep -v "\.h$|\.a$"`
LIST2=`grep "[ 	].*${REL}[ 	].*" $MASTER2 | grep -v "d--" | awk '{ print $1 }' | egrep -v "\.h$|\.a$"`
if [ "$LIST1" -o "$LIST2" ]; then
	echo "\nThe following files are being mcs'd and stripped:"
fi
for file in `echo $LIST1 $LIST2 | xargs file | grep ":.*\	.*executable" | awk '{ print $1 }' | sed 's/:$//' | sort -u`; do
	echo "----------------------------"
	echo "mcs'ing $file"
	mcs -d $file
	echo "stripping $file"
	strip $file
done
IFS=" 	
"
ARLIST=`grep "[ 	].*${REL}[ 	].*" $MASTER1 $MASTER2 | sed 's/^.*:\//\//' | awk '{ print $1 }' | grep "\.a$" | sort -u`
if [ "$ARLIST" ]; then
	echo "\n===== mcs'ing archive files\n"
fi
for file in $ARLIST; do
	echo "----------------------------"
	echo "mcs'ing $file"
	mcs -d $file
	ar s $file
done
