--- trunk/src/devices/makeautodev.sh 2007/10/08 16:18:00 4 +++ trunk/src/devices/makeautodev.sh 2007/10/08 16:19:37 22 @@ -27,7 +27,8 @@ # SUCH DAMAGE. # # -# $Id: makeautodev.sh,v 1.2 2005/02/22 13:23:43 debug Exp $ +# $Id: makeautodev.sh,v 1.6 2006/02/09 20:02:59 debug Exp $ + printf "Generating autodev.c... " @@ -37,23 +38,55 @@ cat autodev_head.c >> autodev.c -for a in `echo dev_*.o`; do - B=`echo $a|cut -c5-|sed s/\\\\.o//g` - if grep devinit_$B dev_$B.c > /dev/null; then - printf "int devinit_$B(struct devinit *);\n" >> autodev.c +printf "4" +for a in dev_*.c; do + B=`grep DEVINIT $a` + if [ z"$B" != z ]; then + C=`grep DEVINIT $a | cut -d \( -f 2|cut -d \) -f 1` + for B in $C; do + printf "int devinit_$B(struct devinit *);\n" >> autodev.c + done + fi +done + +printf "3" +for a in bus_pci.c; do + B=`grep PCIINIT $a` + if [ z"$B" != z ]; then + C=`grep PCIINIT $a | cut -d \( -f 2|cut -d \) -f 1` + for B in $C; do + printf "void pciinit_$B(struct machine *, " >> autodev.c + printf "struct memory *, struct pci_device *);\n" >> autodev.c + done fi done cat autodev_middle.c >> autodev.c -for a in `echo dev_*.o`; do - B=`echo $a|cut -c5-|sed s/\\\\.o//g` - if grep devinit_$B dev_$B.c > /dev/null; then - printf "\tdevice_register(\""$B"\"," >> autodev.c - printf " devinit_$B);\n" >> autodev.c +printf "2" +for a in dev_*.c; do + B=`grep DEVINIT $a` + if [ z"$B" != z ]; then + C=`grep DEVINIT $a | cut -d \( -f 2|cut -d \) -f 1` + for B in $C; do + printf "\tdevice_register(\""$B"\"," >> autodev.c + printf " devinit_$B);\n" >> autodev.c + done + fi +done + +printf "1" +for a in bus_pci.c; do + B=`grep PCIINIT $a` + if [ z"$B" != z ]; then + C=`grep PCIINIT $a | cut -d \( -f 2|cut -d \) -f 1` + for B in $C; do + printf "\tpci_register(\""$B"\"," >> autodev.c + printf " pciinit_$B);\n" >> autodev.c + done fi done cat autodev_tail.c >> autodev.c -printf "done\n" +printf " done\n"