summaryrefslogtreecommitdiffstats
path: root/scripts/mkgdbspec
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mkgdbspec')
-rw-r--r--scripts/mkgdbspec45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/mkgdbspec b/scripts/mkgdbspec
new file mode 100644
index 0000000000..2d35d72b6e
--- /dev/null
+++ b/scripts/mkgdbspec
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Usage: mktoolspec CPU
+#
+
+RTEMS_DIR=`dirname $0`
+RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
+sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
+
+target_alias=$1
+release=0
+
+# Some linux distributions use /usr/src/packages
+# redhat uses /usr/src/redhat
+# others might use /usr/src
+if test -d /usr/src/packages/SPECS;
+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;
+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" \
+< ${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}/rtems-$target_alias-gdb.spec.