diff options
author | Richard Stallman <rms@gnu.org> | 1993-11-09 23:53:36 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-11-09 23:53:36 +0000 |
commit | b1533c05154cce85966c3456e1eb98327ce9847c (patch) | |
tree | 623ebe15571cc33659b866f7cad4022d5d707d55 /gcc | |
parent | 2878315f416febae786ade601b66e031b8257c1c (diff) | |
download | gcc-b1533c05154cce85966c3456e1eb98327ce9847c.zip gcc-b1533c05154cce85966c3456e1eb98327ce9847c.tar.gz gcc-b1533c05154cce85966c3456e1eb98327ce9847c.tar.bz2 |
(loop on $required): When a file is copied
because another file needs it, scan it for what files it needs.
From-SVN: r6045
Diffstat (limited to 'gcc')
-rwxr-xr-x | gcc/fixincludes | 37 |
1 files 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} |