Browse Source

* Improve script to generate gdblib.inc

git-svn-id: trunk@14154 -
pierre 15 years ago
parent
commit
5bc3c1f53d
1 changed files with 30 additions and 10 deletions
  1. 30 10
      packages/gdbint/gen-gdblib-inc.sh

+ 30 - 10
packages/gdbint/gen-gdblib-inc.sh

@@ -8,8 +8,11 @@ if [ "$PATHEXT" != "" ]; then
 else
   EXEEXT=
 fi
+
+echo "Deleting gdb${EXEEXT} to force recompile"
 rm -f gdb${EXEEXT}
-make | tee make.log
+echo "Rebuilding gdb${EXEEXT}"
+make gdb${EXEEXT} | tee make.log
 
 gdb_full_version=`sed -n "s:.*version.*\"\(.*\)\".*:\1:p" version.c`
 gdb_version1=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\1:p" version.c`
@@ -52,7 +55,17 @@ cat comp-cmd.log |gawk -v destdir=${destdir} '
 BEGIN {
   print "#!/bin/bash"
   print "# copy-libs.sh generated by awk script"
-  print "cp gdblib.inc " destdir
+  print "if [ \"$1\" != \"\" ]; then"
+  print "  destdir=$1"
+  print " ginstall -d ${destdir}"
+  print "else"
+  print "  echo $0 destdir"
+  print "  echo destdir should be the location where libgdb.a"
+  print "  echo and all other archives should be copied"
+  print "  exit"
+  print "fi"
+  print "# Copy gdblib.inc file"
+  print "cp gdblib.inc ${destdir}"
 }
 
 {
@@ -60,17 +73,17 @@ BEGIN {
  
   for (i=1; i<=nb; i++) {
   if ( list[i] ~ /lib[^ ]*\.a/ ) {
-  libs = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
-  print "cp " libs destdir;
+  staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
+  print "cp " staticlib " ${destdir}";
   }
   if ( list[i] ~ /-l/ ) {
   systemlib = gensub (/-l([^ ]*)/,"lib\\1.a ","g",list[i]);
   print "systemlib=`find /lib -name " systemlib "`" ;
   print "if [ \"${systemlib}\" != \"\" ]; then";
   print "echo System lib found: ${systemlib}";
-  print "cp ${systemlib} " destdir;
+  print "cp ${systemlib} ${destdir}";
   print "else";
-  print "echo Library " systemlib " not found";
+  print "echo Library " systemlib " not found, shared library assumed";
   print "fi";
   }
   }
@@ -83,6 +96,7 @@ echo Creating ./gdblib.inc file
 # Generate gdblib.inc file
 cat comp-cmd.log |gawk -v destdir=${destdir} -v gdbversion=${gdbversion} '
 BEGIN {
+  use_mingw=0;
   print "{ libgdb.inc file generated by awk script }"
   print "{$define GDB_V" gdbversion " }"
   print "{$ifdef COMPILING_GDBINT_UNIT }"
@@ -93,18 +107,24 @@ BEGIN {
  
   for (i=1; i<=nb; i++) {
   if ( list[i] ~ /lib[^ ]*\.a/ ) {
-  libs = gensub (/([^ ]*)(lib[^ ]*\.a)/,"{$LINKLIB \\2} { found in \\1 }","g",list[i]);
-  print libs;
+    staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"{$LINKLIB \\2} { found in \\1 }","g",list[i]);
+    print staticlib;
+    if ( list[i] ~/mingw/ ) {
+    use_mingw=1
+    }
   }
   if ( list[i] ~ /-l/ ) {
-  dlibs = gensub (/-l([^ ]*)/,"{$LINKLIB \\1} { with -l gcc option}","g",list[i]);
-  print dlibs;
+    systemlib = gensub (/-l([^ ]*)/,"{$LINKLIB \\1} { with -l gcc option}","g",list[i]);
+    print systemlib;
   }
   }
 }
 END {
   print "{$endif COMPILING_GDBINT_UNIT }"
   print "{$undef NotImplemented}"
+  if ( use_mingw == 1 ) {
+    print "{$define USE_MINGW_GDB}"
+  }  
 }
 ' | tee  gdblib.inc