Index: scripts/Makefile.am
===================================================================
--- scripts/Makefile.am	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/Makefile.am	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -28,4 +28,2 @@
 
 DISTCLEANFILES = setup.cache
-
-CLEANFILES = buildall
Index: scripts/binutils/Makefile.am
===================================================================
--- scripts/binutils/Makefile.am	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/binutils/Makefile.am	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -1,31 +1,34 @@
+## $Id$
+
 AUTOMAKE_OPTIONS = foreign
 
-MKBINUTILSSPEC = $(SHELL) $(top_srcdir)/mkbinutilspec
+MKBINUTILSSPEC = $(SHELL) $(top_builddir)/mkbinutilspec
 
-MKBINUTILSSPEC_DEPS = ../mkbinutilspec binutils.spec.in ../setup.cache
+MKBINUTILSSPEC_DEPS = \
+$(top_builddir)/mkbinutilspec binutils.spec.in $(top_builddir)/setup.cache
 
 i386-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . i386-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . i386-rtems
 
 sh-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . sh-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtems
 
 powerpc-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . powerpc-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . powerpc-rtems
 
 sparc-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . sparc-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . sparc-rtems
 
 m68k-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . m68k-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . m68k-rtems
 
 mips64orion-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . mips64orion-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . mips64orion-rtems
 
 i960-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . i960-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . i960-rtems
 
 hppa1.1-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
-	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . hppa1.1-rtems
+	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache -o . hppa1.1-rtems
 
 TEMPLATES = \
Index: scripts/binutils/Makefile.in
===================================================================
--- scripts/binutils/Makefile.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/binutils/Makefile.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -77,5 +77,5 @@
 
 
-RPM_SPECS_DATA =  i386-rtems-$(BINUTILSVERS).spec sh-rtems-$(BINUTILSVERS).spec powerpc-rtems-$(BINUTILSVERS).spec sparc-rtems-$(BINUTILSVERS).spec m68k-rtems-$(BINUTILSVERS).spec mips64orion-rtems-$(BINUTILSVERS).spec i960-rtems-$(BINUTILSVERS).spec hppa1.1-rtems-$(BINUTILSVERS).spec
+RPM_SPECS_DATA =  i386-rtems-$(BINUTILSVERS).spec sh-rtems-$(BINUTILSVERS).spec sh-rtemself-$(BINUTILSVERS).spec powerpc-rtems-$(BINUTILSVERS).spec sparc-rtems-$(BINUTILSVERS).spec m68k-rtems-$(BINUTILSVERS).spec m68k-rtemself-$(BINUTILSVERS).spec mips64orion-rtems-$(BINUTILSVERS).spec i960-rtems-$(BINUTILSVERS).spec hppa1.1-rtems-$(BINUTILSVERS).spec
 
 
@@ -219,4 +219,7 @@
 	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . sh-rtems
 
+sh-rtemself-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
+	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . sh-rtemself
+
 powerpc-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . powerpc-rtems
@@ -227,4 +230,7 @@
 m68k-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . m68k-rtems
+
+m68k-rtemself-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
+	$(MKBINUTILSSPEC) -cfg ../setup.cache -o . m68k-rtemself
 
 mips64orion-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
Index: scripts/binutils/binutils.spec.in
===================================================================
--- scripts/binutils/binutils.spec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/binutils/binutils.spec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -94,5 +94,5 @@
 
 %files -f files
-%dir /opt/rtems/info
+%docdir /opt/rtems/info
 %doc /opt/rtems/info/dir
 %doc /opt/rtems/info/as.info.gz
@@ -107,6 +107,6 @@
 %doc /opt/rtems/info/standards.info.gz
 
-%dir /opt/rtems/man
-%dir /opt/rtems/man/man1
+%docdir /opt/rtems/man
+%docdir /opt/rtems/man/man1
 %doc /opt/rtems/man/man1/@target_alias@-*.1
 
Index: scripts/buildall.in
===================================================================
--- scripts/buildall.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/buildall.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -5,5 +5,5 @@
 
 RTEMS_DIR=`dirname $0`
-CFG=./user.cfg
+CFG=./setup.cache
 dst=@RPM_SPECSdir@
 
@@ -12,5 +12,5 @@
   echo "$0 [options] <target_alias>"
   echo "  options:"
-  echo "    -cfg <user.cfg>"
+  echo "    -cfg <setup.cache>"
   echo "    -o <rpm-spec-dir>"
   exit 1 ;
@@ -61,10 +61,10 @@
 newlib=${newlib_version}
 # also use binutils_rpm_release
-buildroot=/opt/tmp
+buildroot=/tmp
 
 testing=no
-do_binutils=yes
-do_gdb=yes
-do_gccnewlib=yes
+do_binutils=no
+do_gdb=no
+do_gccnewlib=no
 
 #
@@ -101,4 +101,8 @@
   do
     tspecs=`find . -name "${target}*"`
+    if [ "X${tspecs}" = "X" ] ; then
+      echo RPM specifications were not generated for ${tspec}.
+      exit 1
+    fi
     ${ECHO} cp -r ${tspecs} ${dst}
   done
@@ -120,5 +124,5 @@
     fi
     ${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils*
-    ${ECHO} rm -rf ${buildroot}/opt
+    ${ECHO} rm -rf ${buildroot}/opt/rtems
   else
     echo Skipping binutils for ${target}
@@ -145,7 +149,8 @@
     if [ ${testing} = no ] ; then
       rpm -ba ${specfile} >${logfile} 2>&1
+exit 0
     fi
     ${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc*
-    ${ECHO} rm -rf ${buildroot}/opt
+    ${ECHO} rm -rf ${buildroot}/opt/rtems
 
     echo uninstalling binutils for ${target} 
@@ -170,5 +175,5 @@
     fi
     ${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb*
-    ${ECHO} rm -rf ${buildroot}/opt
+    ${ECHO} rm -rf ${buildroot}/opt/rtems
   else
     echo Skipping gdb for ${target}
Index: scripts/configure.in
===================================================================
--- scripts/configure.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/configure.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -1,6 +1,10 @@
+## $Id$
+
 AC_INIT(binutils)
-AM_INIT_AUTOMAKE(scripts,19991020-1,no)
+AM_INIT_AUTOMAKE(scripts,19991021-0,no)
 
-test -f ./setup.cache || cp ./setup.def ./setup.cache
+RTEMS_CHECK_VERSION(..)
+
+test -f ./setup.cache || cp ${srcdir}/setup.def ./setup.cache
 . ./setup.cache
 
@@ -19,5 +23,5 @@
   RPM_SPECSdir=/usr/src/SPECS;
 fi
-if test x"$RPM_SPECSdir" = x; then
+if test x"$RPM_SPECSdir" = x"" ; then
 AC_MSG_ERROR(not found)
 fi
@@ -31,5 +35,5 @@
 GDBVERS="gdb-${gdb_version}"
 AC_SUBST(GDBVERS)
-BSPVERS="RTEMS-no_version_yet"
+BSPVERS="${RTEMS_VERSION}"
 AC_SUBST(BSPVERS)
 
Index: scripts/gccnewlib/Makefile.am
===================================================================
--- scripts/gccnewlib/Makefile.am	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gccnewlib/Makefile.am	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -1,32 +1,34 @@
+## $Id$
+
 AUTOMAKE_OPTIONS = foreign
 
-MKGCCNEWLIBSPEC = $(SHELL) ../mkgccnewlibspec
+MKGCCNEWLIBSPEC = $(SHELL) $(top_builddir)/mkgccnewlibspec
 
 MKGCCNEWLIBSPEC_DEPS = \
-  ../mkgccnewlibspec gccnewlib.spec.in ../setup.cache
+  $(top_builddir)/mkgccnewlibspec gccnewlib.spec.in $(top_builddir)/setup.cache
 
 i386-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . i386-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . i386-rtems
 
 sh-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . sh-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtems
 
 powerpc-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . powerpc-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . powerpc-rtems
 
 sparc-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . sparc-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . sparc-rtems
 
 m68k-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . m68k-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . m68k-rtems
 
 mips64orion-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . mips64orion-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . mips64orion-rtems
 
 i960-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . i960-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . i960-rtems
 
 hppa1.1-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
-	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . hppa1.1-rtems
+	$(MKGCCNEWLIBSPEC) -cfg $(top_builddir)/setup.cache -o . hppa1.1-rtems
 
 TEMPLATES = \
Index: scripts/gccnewlib/Makefile.in
===================================================================
--- scripts/gccnewlib/Makefile.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gccnewlib/Makefile.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -78,5 +78,5 @@
 
 
-RPM_SPECS_DATA =  i386-rtems-$(GCCNEWLIBVERS).spec sh-rtems-$(GCCNEWLIBVERS).spec powerpc-rtems-$(GCCNEWLIBVERS).spec sparc-rtems-$(GCCNEWLIBVERS).spec m68k-rtems-$(GCCNEWLIBVERS).spec mips64orion-rtems-$(GCCNEWLIBVERS).spec i960-rtems-$(GCCNEWLIBVERS).spec hppa1.1-rtems-$(GCCNEWLIBVERS).spec
+RPM_SPECS_DATA =  i386-rtems-$(GCCNEWLIBVERS).spec sh-rtems-$(GCCNEWLIBVERS).spec sh-rtemself-$(GCCNEWLIBVERS).spec powerpc-rtems-$(GCCNEWLIBVERS).spec sparc-rtems-$(GCCNEWLIBVERS).spec m68k-rtems-$(GCCNEWLIBVERS).spec m68k-rtemself-$(GCCNEWLIBVERS).spec mips64orion-rtems-$(GCCNEWLIBVERS).spec i960-rtems-$(GCCNEWLIBVERS).spec hppa1.1-rtems-$(GCCNEWLIBVERS).spec
 
 
@@ -220,4 +220,7 @@
 	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . sh-rtems
 
+sh-rtemself-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
+	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . sh-rtemself
+
 powerpc-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
 	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . powerpc-rtems
@@ -228,4 +231,7 @@
 m68k-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
 	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . m68k-rtems
+
+m68k-rtemself-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
+	$(MKGCCNEWLIBSPEC) -cfg ../setup.cache -o . m68k-rtemself
 
 mips64orion-rtems-$(GCCNEWLIBVERS).spec: $(MKGCCNEWLIBSPEC_DEPS)
Index: scripts/gccnewlib/gccnewlib.spec.in
===================================================================
--- scripts/gccnewlib/gccnewlib.spec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gccnewlib/gccnewlib.spec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -75,15 +75,44 @@
   cd @target_alias@/newlib
   make prefix=$RPM_BUILD_ROOT/opt/rtems install-info
-# gzip info files
+
+  # cd back to build/
+  cd ../..
+
+  # gzip info files
   gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info 2>/dev/null
   gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-? 2>/dev/null
   gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-?? 2>/dev/null
- 
+
+  rm -f files
+
+  # collect c++ headers
+  if test -d $RPM_BUILD_ROOT/opt/rtems/include/g++-3; then
+    find $RPM_BUILD_ROOT/opt/rtems/include/g++-3 \
+      -type d | \
+      sed -e "s,^$RPM_BUILD_ROOT,%dir ,g" >> files
+    find $RPM_BUILD_ROOT/opt/rtems/include/g++-3 \
+      \( -type f -o -type l \) | \
+      sed -e "s,^$RPM_BUILD_ROOT,,g" >> files
+  fi
+
+  # collect target gcc-lib
   if test -d "$RPM_BUILD_ROOT/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@"; \
   then
-    find "$RPM_BUILD_ROOT/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@" -type d | \
-      sed -e "s,^$RPM_BUILD_ROOT,%dir ,g" > files.gcc-lib
-    find "$RPM_BUILD_ROOT/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@" -type f | \
-      sed -e "s,^$RPM_BUILD_ROOT,,g" >> files.gcc-lib
+    find "$RPM_BUILD_ROOT/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@" \
+      -type d | sed -e "s,^$RPM_BUILD_ROOT,%dir ,g" >> files
+    find "$RPM_BUILD_ROOT/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@" \
+      \( -type f -o -type l \) \
+      | sed -e "s,^$RPM_BUILD_ROOT,,g" >> files
+  fi
+
+  # collect target files
+  if test -d "$RPM_BUILD_ROOT/opt/rtems/@target_alias@"; \
+  then
+    find "$RPM_BUILD_ROOT/opt/rtems/@target_alias@" \
+      -type d | \
+      sed -e "s,^$RPM_BUILD_ROOT,%dir ,g" >> files
+    find "$RPM_BUILD_ROOT/opt/rtems/@target_alias@" \
+      \( -type f -o -type l \) | \
+      sed -e "s,^$RPM_BUILD_ROOT,,g" >> files
   fi
 
@@ -108,5 +137,5 @@
   fi
 
-%files -f files.g++ -f files.gcc-lib
+%files -f build/files
 %docdir /opt/rtems/info
 %doc /opt/rtems/info/dir
@@ -127,17 +156,22 @@
 %dir /opt/rtems/bin
 /opt/rtems/bin/cpp
+/opt/rtems/bin/jv-scan
+/opt/rtems/bin/gcov
+/opt/rtems/bin/jcf-dump
+/opt/rtems/bin/gcjh
 /opt/rtems/bin/@target_alias@-c++
 /opt/rtems/bin/@target_alias@-g++
 /opt/rtems/bin/@target_alias@-gcc
 /opt/rtems/bin/@target_alias@-gcj
+/opt/rtems/bin/@target_alias@-chill
+/opt/rtems/bin/@target_alias@-g77
+/opt/rtems/bin/@target_alias@-protoize
+/opt/rtems/bin/@target_alias@-unprotoize
 
 %dir /opt/rtems/lib
 /opt/rtems/lib/libiberty*
-%dir /opt/rtems/lib/include
+%dir /opt/rtems/include
 
 %dir /opt/rtems/lib/gcc-lib
 %dir /opt/rtems/lib/gcc-lib/@target_alias@
-# /opt/rtems/@target_alias@/include
-# /opt/rtems/@target_alias@/sys-include
-/opt/rtems/@target_alias@/lib
 
Index: scripts/gdb/Makefile.am
===================================================================
--- scripts/gdb/Makefile.am	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gdb/Makefile.am	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -1,31 +1,32 @@
 AUTOMAKE_OPTIONS = foreign
 
-MKGDBSPEC = $(SHELL) $(top_srcdir)/mkgdbspec
+MKGDBSPEC = $(SHELL) $(top_builddir)/mkgdbspec
 
-MKGDBSPEC_DEPS = ../mkgdbspec gdb.spec.in ../setup.cache
+MKGDBSPEC_DEPS = \
+$(top_builddir)/mkgdbspec gdb.spec.in $(top_builddir)/setup.cache
 
 i386-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . i386-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . i386-rtems
 
 sh-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . sh-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtems
 
 powerpc-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . powerpc-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . powerpc-rtems
 
 sparc-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . sparc-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . sparc-rtems
 
 m68k-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . m68k-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . m68k-rtems
 
 mips64orion-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . mips64orion-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . mips64orion-rtems
 
 i960-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . i960-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . i960-rtems
 
 hppa1.1-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
-	$(MKGDBSPEC) -cfg ../setup.cache -o . hppa1.1-rtems
+	$(MKGDBSPEC) -cfg $(top_builddir)/setup.cache -o . hppa1.1-rtems
 
 TEMPLATES = \
Index: scripts/gdb/Makefile.in
===================================================================
--- scripts/gdb/Makefile.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gdb/Makefile.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -77,5 +77,5 @@
 
 
-RPM_SPECS_DATA =  i386-rtems-$(GDBVERS).spec sh-rtems-$(GDBVERS).spec powerpc-rtems-$(GDBVERS).spec sparc-rtems-$(GDBVERS).spec m68k-rtems-$(GDBVERS).spec mips64orion-rtems-$(GDBVERS).spec i960-rtems-$(GDBVERS).spec hppa1.1-rtems-$(GDBVERS).spec
+RPM_SPECS_DATA =  i386-rtems-$(GDBVERS).spec sh-rtems-$(GDBVERS).spec sh-rtemself-$(GDBVERS).spec powerpc-rtems-$(GDBVERS).spec sparc-rtems-$(GDBVERS).spec m68k-rtems-$(GDBVERS).spec m68k-rtemself-$(GDBVERS).spec mips64orion-rtems-$(GDBVERS).spec i960-rtems-$(GDBVERS).spec hppa1.1-rtems-$(GDBVERS).spec
 
 
@@ -219,4 +219,7 @@
 	$(MKGDBSPEC) -cfg ../setup.cache -o . sh-rtems
 
+sh-rtemself-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
+	$(MKGDBSPEC) -cfg ../setup.cache -o . sh-rtemself
+
 powerpc-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
 	$(MKGDBSPEC) -cfg ../setup.cache -o . powerpc-rtems
@@ -227,4 +230,7 @@
 m68k-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
 	$(MKGDBSPEC) -cfg ../setup.cache -o . m68k-rtems
+
+m68k-rtemself-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
+	$(MKGDBSPEC) -cfg ../setup.cache -o . m68k-rtemself
 
 mips64orion-rtems-$(GDBVERS).spec: $(MKGDBSPEC_DEPS)
Index: scripts/gdb/gdb.spec.in
===================================================================
--- scripts/gdb/gdb.spec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/gdb/gdb.spec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -50,9 +50,4 @@
     --verbose --prefix=/opt/rtems 
 
-  test -d $RPM_BUILD_ROOT/opt \
-    || mkdir $RPM_BUILD_ROOT/opt
-  test -d $RPM_BUILD_ROOT/opt/rtems \
-    || mkdir $RPM_BUILD_ROOT/opt/rtems
-
   make all
   make info
@@ -84,20 +79,23 @@
 
 %files
-%dir /opt/rtems/info
+%docdir /opt/rtems/info
 %doc /opt/rtems/info/gdb.info*
 %doc /opt/rtems/info/mmalloc.info*
 %doc /opt/rtems/info/readline.info*
 
-%dir /opt/rtems/man
-%dir /opt/rtems/man/man1
+%docdir /opt/rtems/man
+%docdir /opt/rtems/man/man1
 %doc /opt/rtems/man/man1/@target_alias@-gdb.1
 
 %dir /opt/rtems/include
-/opt/rtems/include/bfd.h
-/opt/rtems/include/bfdlink.h
+# We install libbfd from binutils
+# /opt/rtems/include/bfd.h
+# /opt/rtems/include/bfdlink.h
 
 %dir /opt/rtems/lib
-/opt/rtems/lib/libbfd*
-/opt/rtems/lib/libiberty*
+# We install libbfd from binutils
+# /opt/rtems/lib/libbfd*
+# We use libiberty from gcc
+# /opt/rtems/lib/libiberty*
 
 %dir /opt/rtems/bin
Index: scripts/mkbinutils_subpackage_version
===================================================================
--- scripts/mkbinutils_subpackage_version	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/mkbinutils_subpackage_version	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -62,5 +62,5 @@
 echo "Patch0:		binutils-990901-rtems-19991015.diff"
 echo ""
-echo "Buildroot:    /opt/tmp"
+echo "Buildroot:    /tmp"
 echo "# Patch:"
 echo "%description"
Index: scripts/mkbinutilspec.in
===================================================================
--- scripts/mkbinutilspec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/mkbinutilspec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -4,7 +4,7 @@
 #
 
-RTEMS_DIR=`dirname $0`
+RTEMS_DIR=`dirname $0`/@top_srcdir@
 
-CFG=user.cfg
+CFG=setup.cache
 dst=@RPM_SPECSdir@
 
@@ -13,5 +13,5 @@
   echo "$0 [options] <target_alias>"
   echo "  options:"
-  echo "    -cfg <user.cfg>"
+  echo "    -cfg <setup.cache>"
   echo "    -o <rpm-spec-dir>"
   exit 1 ;
Index: scripts/mkbspspec.in
===================================================================
--- scripts/mkbspspec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/mkbspspec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -2,30 +2,58 @@
 #
 
-RTEMS_DIR=`dirname $0`
-RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
-sed -e 's%RTEMS[ 	]*Version[ 	]*\(.*\)[ 	]*%\1%g'`
+RTEMS_DIR=`dirname $0`/@top_srcdir@
+RTEMS_VERSION=@RTEMS_VERSION@
 
-bsp=$1
-target_alias=$2
-release=0
+CFG=setup.cache
+dst=@RPM_SPECSdir@
 
-# Some linux distributions use /usr/src/packages
-# redhat uses /usr/src/redhat
-# others might use /usr/src
-if test -d /usr/src/packages/SPECS; 
+usage()
+{
+  echo "$0 [options] <target_alias> <bsp>"
+  echo "  options:"
+  echo "    -cfg <setup.cache>"
+  echo "    -o <rpm-spec-dir>"
+  exit 1 ;
+}
+
+while test $# -ge 3; do
+case $1 in
+-cfg) 
+  shift
+  CFG=$1
+  shift
+  ;;
+-o)
+  shift
+  dst=$1
+  shift
+  ;;
+-*)
+  echo "invalid option $1";
+  usage
+  ;;
+esac
+done
+
+if test ! $# -eq 2;
 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
+
+# target to build for
+target_alias=$1
+bsp=$2
+
+. ./$CFG
+
+specfile=${dst}/$target_alias-$bsp-$RTEMS_VERSION.spec
 
 sed -e "s%@Version@%${RTEMS_VERSION}%g" \
 -e "s%@bsp@%${bsp}%g" \
--e "s%@Release@%${release}%g" \
+-e "s%@Release@%${rtems_release}%g" \
 -e "s%@target_alias@%${target_alias}%g" \
-< ${RTEMS_DIR}/rtems.spec.in \
-> ${dst}/rtems-$target_alias-$bsp.spec
+< ${RTEMS_DIR}/rtems/rtems.spec.in \
+> ${specfile}
+
+echo Generated ${specfile}
Index: scripts/mkgccnewlibspec.in
===================================================================
--- scripts/mkgccnewlibspec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/mkgccnewlibspec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -4,7 +4,7 @@
 #
 
-RTEMS_DIR=`dirname $0`
+RTEMS_DIR=`dirname $0`/@top_srcdir@
 
-CFG=user.cfg
+CFG=setup.cache
 dst=@RPM_SPECSdir@
 
@@ -13,5 +13,5 @@
   echo "$0 [options] <target_alias>"
   echo "  options:"
-  echo "    -cfg <user.cfg>"
+  echo "    -cfg <setup.cache>"
   echo "    -o <rpm-spec-dir>"
   exit 1 ;
Index: scripts/mkgdbspec.in
===================================================================
--- scripts/mkgdbspec.in	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/mkgdbspec.in	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -4,6 +4,7 @@
 #
 
-RTEMS_DIR=`dirname $0`
-CFG=user.cfg
+RTEMS_DIR=`dirname $0`/@top_srcdir@
+
+CFG=setup.cache
 dst=@RPM_SPECSdir@
 
@@ -12,5 +13,5 @@
   echo "$0 [options] <target_alias>"
   echo "  options:"
-  echo "    -cfg <user.cfg>"
+  echo "    -cfg <setup.cache>"
   echo "    -o <rpm-spec-dir>"
   exit 1 ;
Index: scripts/rtems/Makefile.am
===================================================================
--- scripts/rtems/Makefile.am	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/rtems/Makefile.am	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -1,32 +1,31 @@
 AUTOMAKE_OPTIONS = foreign
 
-# MKBSPSPEC = $(SHELL) $(top_srcdir)/mkbspspec
-MKBSPSPEC = @echo $(top_srcdir)/mkbspspec
+MKBSPSPEC = $(SHELL) $(top_builddir)/mkbspspec
 
-MKBSPSPEC_DEPS = ../mkbspspec rtems.spec.in ../setup.cache
+MKBSPSPEC_DEPS = $(top_builddir)/mkbspspec rtems.spec.in $(top_builddir)/setup.cache
 
-i386-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . i386-rtems
+i386-rtems-pc386-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . i386-rtems pc386
 
-sh-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . sh-rtems
+sh-rtems-gensh1-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . sh-rtems gensh1
 
-powerpc-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . powerpc-rtems
+powerpc-rtems-mcp750-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . powerpc-rtems mcp750
 
-sparc-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . sparc-rtems
+sparc-rtems-erc32-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . sparc-rtems erc32
 
-m68k-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . m68k-rtems
+m68k-rtems-gen68360-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . m68k-rtems gen68360
 
-mips64orion-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . mips64orion-rtems
+mips64orion-rtems-p4600-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . mips64orion-rtems p4600
 
-i960-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . i960-rtems
+i960-rtems-cvme961-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . i960-rtems cvme961
 
-hppa1.1-rtems-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
-	$(MKBSPSPEC) -cfg ../setup.cache -o . hppa1.1-rtems
+hppa1.1-rtems-simhppa-$(BSPVERS).spec: $(MKBSPSPEC_DEPS)
+	$(MKBSPSPEC) -cfg $(top_builddir)/setup.cache -o . hppa1.1-rtems simhppa
 
 TEMPLATES = \
@@ -34,12 +33,12 @@
 
 RPM_SPECS_DATA = \
-i386-rtems-$(BSPVERS).spec \
-sh-rtems-$(BSPVERS).spec \
-powerpc-rtems-$(BSPVERS).spec \
-sparc-rtems-$(BSPVERS).spec \
-m68k-rtems-$(BSPVERS).spec \
-mips64orion-rtems-$(BSPVERS).spec \
-i960-rtems-$(BSPVERS).spec \
-hppa1.1-rtems-$(BSPVERS).spec
+i386-rtems-pc386-$(BSPVERS).spec \
+sh-rtems-gensh1-$(BSPVERS).spec \
+powerpc-rtems-mcp750-$(BSPVERS).spec \
+sparc-rtems-erc32-$(BSPVERS).spec \
+m68k-rtems-gen68360-$(BSPVERS).spec \
+mips64orion-rtems-p4600-$(BSPVERS).spec \
+i960-rtems-cvme961-$(BSPVERS).spec \
+hppa1.1-rtems-simhppa-$(BSPVERS).spec
 
 noinst_DATA = \
Index: scripts/setup
===================================================================
--- scripts/setup	(revision 8f2cf93145595b8b4359767e5a7922a68af3495d)
+++ scripts/setup	(revision 43e7d103a0aa620f5f75c4ccac2f5b6c3d3f9433)
@@ -5,9 +5,14 @@
 # RTEMS tools setup
 
-test -f ./CFG || echo "restoring default setup.cache" && cp ./setup.def ./$CFG
+if test ! -f ./$CFG;
+then
+ echo -n "restoring default setup.cache .." 
+ cp ./setup.def ./$CFG
+ echo " done"
+fi
 
 echo -n "loading setup from ./$CFG .."
 . ./$CFG
-echo "done"
+echo " done"
 echo
 
