From d2c0576ddcafd6307068a01388cff96be4d914a1 Mon Sep 17 00:00:00 2001 From: rms Date: Tue, 9 Nov 1993 23:53:36 +0000 Subject: [PATCH] (loop on $required): When a file is copied because another file needs it, scan it for what files it needs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6045 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fixincludes | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/gcc/fixincludes b/gcc/fixincludes index 39d93cd..b2d527d 100755 --- a/gcc/fixincludes +++ b/gcc/fixincludes @@ -339,20 +339,29 @@ done # Make sure that any include files referenced using double quotes # exist in the fixed directory. -set x $required -shift -while [ $# != 0 ]; do - # $1 is the directory to copy from, $2 is the unfixed file, - # $3 is the fixed file name. - cd ${INPUT} - cd $1 - if [ -r $2 ] && [ ! -r $3 ]; then - cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" - chmod +w $3 2>/dev/null - chmod a+r $3 2>/dev/null - echo Copied $2 - fi - shift; shift; shift +while [ -n "$required" ]; do + newreq= + set x $required + shift + while [ $# != 0 ]; do + # $1 is the directory to copy from, $2 is the unfixed file, + # $3 is the fixed file name. + cd ${INPUT} + cd $1 + if [ -r $2 ] && [ ! -r $3 ]; then + cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" + chmod +w $3 2>/dev/null + chmod a+r $3 2>/dev/null + echo Copied $2 + for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do + dir=`echo $2 | sed -e s'|/[^/]*$||'` + dir2=`echo $3 | sed -e s'|/[^/]*$||'` + newreq="$newreq $1 $dir/$include $dir2/$include" + done + fi + shift; shift; shift + done + required=$newreq done cd ${INPUT} -- 2.7.4