Index: scripts/Makefile.in
===================================================================
--- scripts/Makefile.in	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/Makefile.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -1,3 +1,3 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
@@ -47,7 +47,8 @@
 
 INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
@@ -99,5 +100,5 @@
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
@@ -252,5 +253,5 @@
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
@@ -291,5 +292,5 @@
 all-redirect: all-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs: installdirs-recursive
 installdirs-am:
Index: scripts/aclocal.m4
===================================================================
--- scripts/aclocal.m4	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/aclocal.m4	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -1,3 +1,3 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
+dnl aclocal.m4 generated automatically by aclocal 1.4a
 
 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
@@ -22,4 +22,6 @@
 AC_DEFUN(AM_INIT_AUTOMAKE,
 [AC_REQUIRE([AC_PROG_INSTALL])
+dnl We require 2.13 because we rely on SHELL being computed by configure.
+AC_PREREQ([2.13])
 PACKAGE=[$1]
 AC_SUBST(PACKAGE)
Index: scripts/configure
===================================================================
--- scripts/configure	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/configure	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -690,4 +690,5 @@
 
 
+
 PACKAGE=scripts
 
@@ -702,5 +703,5 @@
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:705: checking for working aclocal" >&5
+echo "configure:706: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -715,5 +716,5 @@
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:718: checking for working autoconf" >&5
+echo "configure:719: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -728,5 +729,5 @@
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:731: checking for working automake" >&5
+echo "configure:732: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -741,5 +742,5 @@
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:744: checking for working autoheader" >&5
+echo "configure:745: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -754,5 +755,5 @@
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:757: checking for working makeinfo" >&5
+echo "configure:758: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -775,14 +776,14 @@
 # others might use /usr/src
 echo $ac_n "checking for rpm SPECS directory""... $ac_c" 1>&6
-echo "configure:778: checking for rpm SPECS directory" >&5
+echo "configure:779: checking for rpm SPECS directory" >&5
 if test -d /usr/src/packages/SPECS;
 then
-RPM_SPECSdir=/usr/src/packages/SPECS;
+  RPM_SPECSdir=/usr/src/packages/SPECS;
 elif test -d /usr/src/redhat/SPECS;
 then
-RPM_SPECSdirs=/usr/src/redhat/SPECS;
+  RPM_SPECSdir=/usr/src/redhat/SPECS;
 elif test -d /usr/src/SPECS/;
 then
-RPM_SPECSdir=/usr/src/SPECS;
+  RPM_SPECSdir=/usr/src/SPECS;
 fi
 if test x"$RPM_SPECSdir" = x; then
@@ -915,6 +916,8 @@
 mkbinutilspec
 mkgccnewlibspec
+mkgdbspec
 binutils/Makefile
 gccnewlib/Makefile
+gdb/Makefile
 " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
@@ -1008,6 +1011,8 @@
 mkbinutilspec
 mkgccnewlibspec
+mkgdbspec
 binutils/Makefile
 gccnewlib/Makefile
+gdb/Makefile
 "}
 EOF
Index: scripts/configure.in
===================================================================
--- scripts/configure.in	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/configure.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -36,5 +36,7 @@
 mkbinutilspec
 mkgccnewlibspec
+mkgdbspec
 binutils/Makefile
 gccnewlib/Makefile
+gdb/Makefile
 )
Index: scripts/gccnewlib/Makefile.in
===================================================================
--- scripts/gccnewlib/Makefile.in	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/gccnewlib/Makefile.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -1,3 +1,3 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
@@ -47,7 +47,8 @@
 
 INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
 transform = @program_transform_name@
 
@@ -95,5 +96,5 @@
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
@@ -137,5 +138,5 @@
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
@@ -166,5 +167,5 @@
 all-redirect: all-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
 installdirs:
 	$(mkinstalldirs)  $(DESTDIR)$(RPM_SPECSdir)
Index: scripts/gdb.spec.in
===================================================================
--- scripts/gdb.spec.in	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/gdb.spec.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -20,8 +20,8 @@
 Packager:     corsepiu@faw.uni-ulm.de and joel@OARcorp.com
 
-Version:      @Version@
+Version:      gdb@gdb_version@
 Summary:      gdb for target @target_alias@
-Source0:      	gdb-4.18.tar.gz
-Patch0:		gdb-4.18-rtems-19991015.diff
+Source0:      	gdb-@gdb_version@.tar.gz
+Patch0:		gdb-@gdb_version@-rtems-@gdb_patch_version@.diff
 
 Buildroot:    /tmp
@@ -38,5 +38,5 @@
 
 %prep
-# untar the sources inside @target_alias@-gdb-@Version@
+# untar the sources inside @target_alias@-gdb
 %setup -c -n @target_alias@-gdb -a 0
 
@@ -46,5 +46,5 @@
 test -d build || mkdir build
 ( cd build
-  ../gdb-4.18/configure --target=@target_alias@ \
+  ../gdb-@gdb_version@/configure --target=@target_alias@ \
     --verbose --prefix=/opt/rtems 
 
@@ -65,4 +65,12 @@
 
 %files
+%dir /opt/rtems
+%dir /opt/rtems/bin
+%dir /opt/rtems/include
+%dir /opt/rtems/info
+%dir /opt/rtems/lib
+%dir /opt/rtems/man
+%dir /opt/rtems/man/man1
+
 %doc /opt/rtems/info/gdb.info*
 %doc /opt/rtems/info/mmalloc.info*
Index: scripts/mkbinutilspec
===================================================================
--- scripts/mkbinutilspec	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/mkbinutilspec	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -7,5 +7,5 @@
 
 CFG=user.cfg
-dst=/usr/src/packages/SPECS
+dst=/usr/src/redhat/SPECS
 
 usage()
Index: scripts/mkgccnewlibspec
===================================================================
--- scripts/mkgccnewlibspec	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/mkgccnewlibspec	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -7,5 +7,5 @@
 
 CFG=user.cfg
-dst=/usr/src/packages/SPECS
+dst=/usr/src/redhat/SPECS
 
 usage()
Index: scripts/mkgdbspec
===================================================================
--- scripts/mkgdbspec	(revision 36b6704eab35ccc5d639f472488be7dfa8b917e2)
+++ scripts/mkgdbspec	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -1,32 +1,54 @@
 #!/bin/sh 
 #
-#  Usage: mktoolspec CPU
+#  Usage: mkgdbspec CPU
 #
 
 RTEMS_DIR=`dirname $0`
-RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
-sed -e 's%RTEMS[ 	]*Version[ 	]*\(.*\)[ 	]*%\1%g'`
+CFG=user.cfg
+dst=/usr/src/redhat/SPECS
 
-target_alias=$1
-release=0
+usage()
 
-# Some linux distributions use /usr/src/packages
-# redhat uses /usr/src/redhat
-# others might use /usr/src
-if test -d /usr/src/packages/SPECS; 
+  echo "$0 [options] <target_alias>"
+  echo "  options:"
+  echo "    -cfg <user.cfg>"
+  echo "    -o <rpm-spec-dir>"
+  exit 1 ;
+
+
+while test $# -ge 2; do
+case $1 in
+-cfg)
+  shift
+  CFG=$1
+  shift
+  ;;
+-o)
+  shift
+  dst=$1
+  shift
+  ;;
+-*)
+  echo "invalid option $1";
+  usage
+  ;;
+esac
+done
+
+if test ! $# -eq 1;
 then
-dst=/usr/src/packages/SPECS;
-elif test -d /usr/src/redhat/SPECS;
- then
-dst=/usr/src/redhat/SPECS;
-elif test -d /usr/src/SPECS/; 
-then
-dst=/usr/src/SPECS;
+  echo "Invalid number of arguments"
+  usage
 fi
 
-sed -e "s%@Version@%${RTEMS_VERSION}%g" \
--e "s%@bsp@%${bsp}%g" \
--e "s%@Release@%${release}%g" \
--e "s%@target_alias@%${target_alias}%g" \
+# target to build for
+target_alias=$1
+
+rpm_release=0
+
+sed -e "s%@Release@%${rpm_release}%g" \
+    -e "s%@target_alias@%${target_alias}%g" \
+    -e "s%@gdb_version@%${gdb_version}%g" \
+    -e "s%@gdb_patch_version@%${gdb_patch_version}%g" \
 < ${RTEMS_DIR}/gdb.spec.in \
 > ${dst}/$target_alias-gdb.spec
Index: scripts/mkgdbspec.in
===================================================================
--- scripts/mkgdbspec.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
+++ scripts/mkgdbspec.in	(revision 180501501edec8532c11b1a65c3bc599891334be)
@@ -0,0 +1,67 @@
+#!/bin/sh 
+#
+#  Usage: mkgdbspec CPU
+#
+
+RTEMS_DIR=`dirname $0`
+CFG=user.cfg
+dst=@RPM_SPECSdir@
+
+usage()
+
+  echo "$0 [options] <target_alias>"
+  echo "  options:"
+  echo "    -cfg <user.cfg>"
+  echo "    -o <rpm-spec-dir>"
+  exit 1 ;
+
+
+while test $# -ge 2; do
+case $1 in
+-cfg)
+  shift
+  CFG=$1
+  shift
+  ;;
+-o)
+  shift
+  dst=$1
+  shift
+  ;;
+-*)
+  echo "invalid option $1";
+  usage
+  ;;
+esac
+done
+
+if test ! $# -eq 1;
+then
+  echo "Invalid number of arguments"
+  usage
+fi
+
+# target to build for
+target_alias=$1
+
+rpm_release=0
+
+sed -e "s%@Release@%${rpm_release}%g" \
+    -e "s%@target_alias@%${target_alias}%g" \
+    -e "s%@gdb_version@%${gdb_version}%g" \
+    -e "s%@gdb_patch_version@%${gdb_patch_version}%g" \
+< ${RTEMS_DIR}/gdb.spec.in \
+> ${dst}/$target_alias-gdb.spec
+
+case ${target} in
+  powerpc*)
+     echo "/opt/rtems/bin/@target_alias@-run" 
+     ;;
+  sparc*)
+     echo "/opt/rtems/bin/@target_alias@-run" 
+     echo "/opt/rtems/bin/@target_alias@-sis" 
+     ;;
+  *) ;;
+esac >> ${dst}/$target_alias-gdb.spec
+
+echo Generated ${dst}/$target_alias-gdb.spec.
