From 46041b48c7ad74d1165a8b6123d4d115c06cc5d3 Mon Sep 17 00:00:00 2001 From: "slamm%netscape.com" Date: Thu, 28 Jan 1999 00:21:32 +0000 Subject: [PATCH] Simplify the script. Make it work when objects are not in the source tree. Make it work on Solaris too. --- build/autoconf/update-makefile.sh | 45 +++++++++---------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/build/autoconf/update-makefile.sh b/build/autoconf/update-makefile.sh index 667ae02a47ca..117b0d16d737 100755 --- a/build/autoconf/update-makefile.sh +++ b/build/autoconf/update-makefile.sh @@ -29,47 +29,30 @@ # Send comments, improvements, bugs to ramiro@netscape.com # -# Make sure a Makefile.in exists -if [ ! -f Makefile.in ] +# Make sure a Makefile exists +if [ ! -f Makefile ] then echo - echo "There ain't no 'Makefile.in' over here: $pwd" + echo "There ain't no 'Makefile' over here: $pwd" echo exit fi -# Use DEPTH in the Makefile.in to determine the depth -depth=`grep -w DEPTH Makefile.in | grep -e "\.\." | awk -F"=" '{ print $2; }'` +# Use DEPTH in the Makefile to determine the depth +depth=`egrep '^DEPTH[ ]*=[ ]*\.' Makefile | awk -F= '{ print $2; }'` -# Determine the depth count -n=`echo $depth | tr '/' ' ' | wc -w` - -# Determine the path (strip anything before the mozilla/ root) -path=`pwd | awk -v count=$n -F"/" '\ -{ for(i=NF-count+1; i <= NF ; i++) \ -{ \ -if (i!=NF) \ - { printf "%s/", $i } \ -else \ - { printf "%s", $i } \ -} \ -}'` - -dir=$path - -# Add a slash only to dirs where depth >= mozilla_root -if [ $n -gt 0 ] -then - dir=${dir}"/" -fi - -back=`pwd` - -makefile=${dir}"Makefile" +# Get the full path to the Makefile +makefile=`pwd`/Makefile +# 'cd' to the root of the tree +echo depth=$depth cd $depth +# Strip the tree root off the Makefile's path +root_path=`pwd` +makefile=`expr $makefile : $root_path'/\(.*\)'` + # Make sure config.status exists if [ -f config.status ] then @@ -79,5 +62,3 @@ else echo "There ain't no 'config.status' over here: $pwd" echo fi - -cd $back