1#!/bin/sh 2############################################################################### 3# 4# Copyright (C) 2005-2018 Anders Gavare. All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are met: 8# 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 3. The name of the author may not be used to endorse or promote products 15# derived from this software without specific prior written permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27# SUCH DAMAGE. 28 29 30printf "Generating autodev.cc... " 31 32rm -f autodev.cc 33 34printf "/*\n * DO NOT EDIT. AUTOMATICALLY CREATED\n */\n\n" >> autodev.cc 35 36cat autodev_head.cc >> autodev.cc 37 38printf "5" 39rm -f .index 40for a in *.cc; do 41 B=`grep COMMENT $a` 42 if [ z"$B" != z ]; then 43 printf "$a " >> .index 44 echo "$B"|cut -d : -f 2- >> .index 45 fi 46done 47 48printf "4" 49for a in dev_*.cc; do 50 B=`grep DEVINIT $a` 51 if [ z"$B" != z ]; then 52 C=`grep DEVINIT $a | cut -d \( -f 2|cut -d \) -f 1` 53 for B in $C; do 54 printf "int devinit_$B(struct devinit *);\n" >> autodev.cc 55 done 56 fi 57done 58 59printf "3" 60for a in bus_pci.cc; do 61 B=`grep PCIINIT $a` 62 if [ z"$B" != z ]; then 63 C=`grep PCIINIT $a | cut -d \( -f 2|cut -d \) -f 1` 64 for B in $C; do 65 printf "void pciinit_$B(struct machine *, " >> autodev.cc 66 printf "struct memory *, struct pci_device *);\n" >> autodev.cc 67 done 68 fi 69done 70 71cat autodev_middle.cc >> autodev.cc 72 73printf "2" 74for a in dev_*.cc; do 75 B=`grep DEVINIT $a` 76 if [ z"$B" != z ]; then 77 C=`grep DEVINIT $a | cut -d \( -f 2|cut -d \) -f 1` 78 for B in $C; do 79 printf "\tdevice_register(\""$B"\"," >> autodev.cc 80 printf " devinit_$B);\n" >> autodev.cc 81 done 82 fi 83done 84 85printf "1" 86for a in bus_pci.cc; do 87 B=`grep PCIINIT $a` 88 if [ z"$B" != z ]; then 89 C=`grep PCIINIT $a | cut -d \( -f 2|cut -d \) -f 1` 90 for B in $C; do 91 printf "\tpci_register(\""$B"\"," >> autodev.cc 92 printf " pciinit_$B);\n" >> autodev.cc 93 done 94 fi 95done 96 97cat autodev_tail.cc >> autodev.cc 98 99printf " done\n" 100