#!/bin/sh
DEFINES=`grep "#define" src/mainboard/*/*/romstage.c |sed 's,.*#define[\t ]\([^\t ]*\)[\t ].*,\1,' | grep -v "(" | sort -u`
SCANBUCKET=`mktemp`
find src -name .svn -type d -prune -o -name mainboard -type d -prune -o -type f -exec sed -f remccoms3.sed {} + > $SCANBUCKET
 
for define in $DEFINES; do
	if [ `grep -c $define $SCANBUCKET` -gt 0 ]; then
		echo "$define is defined in mainboard(s) and used elsewhere"
	fi
done

rm -f $SCANBUCKET
