mknative-gdb revision 1.4
11.1Snathanw#!/bin/sh 21.4Schristos# $NetBSD: mknative-gdb,v 1.4 2011/10/09 02:03:30 christos Exp $ 31.1Snathanw# 41.1Snathanw# Shell script for generating all the constants needed for a native 51.3Schristos# platform build of src/external/gpl3/gdb 61.1Snathanw# 71.1Snathanw 81.1Snathanw# initialise 91.1Snathanw 101.1Snathanw_TMPDIR=$2 111.1Snathanw_TOP=$3 121.1Snathanw_PLATFORM=$4 131.1Snathanw_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` 141.3Schristos_GDB=external/gpl3/gdb 151.1Snathanw 161.1Snathanw. $_TOP/tools/gcc/mknative.common 171.1Snathanw 181.3Schristos##### gdb/lib/libbfd ##### 191.1Snathanw 201.1Snathanwget_gdb_libbfd () { 211.3Schristos local _BFD=$_GDB/lib/libbfd 221.3Schristos mkdir -p $_TOP/$_BFD/arch/$MACHINE_ARCH 231.1Snathanw 241.1Snathanw { 251.1Snathanw getvars bfd/Makefile \ 261.1Snathanw libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \ 271.1Snathanw INCLUDES TDEFAULTS 281.3Schristos } | write_mk $_BFD/arch/$MACHINE_ARCH/defs.mk 291.1Snathanw 301.3Schristos for i in bfd-in3.h bfd_stdint.h config.h bfd.h bfdver.h targmatch.h 311.3Schristos do 321.3Schristos write_c $_BFD/arch/$MACHINE_ARCH/$i <$_TMPDIR/bfd/$i 331.3Schristos done 341.1Snathanw} 351.1Snathanw 361.3Schristos##### gdb/lib/libopcodes ##### 371.1Snathanw 381.1Snathanwget_gdb_libopcodes () { 391.3Schristos local _OPCODES=$_GDB/lib/libopcodes 401.3Schristos mkdir -p $_TOP/$_OPCODES/arch/$MACHINE_ARCH 411.1Snathanw 421.1Snathanw { 431.1Snathanw getvars opcodes/Makefile \ 441.1Snathanw archdefs BFD_MACHINES libopcodes_la_SOURCES 451.3Schristos } | write_mk $_GDB/lib/libopcodes//arch/$MACHINE_ARCH/defs.mk 461.1Snathanw 471.1Snathanw { 481.1Snathanw cat $_TMPDIR/opcodes/config.h 491.3Schristos } | write_c $_OPCODES/arch/$MACHINE_ARCH/config.h 501.1Snathanw} 511.1Snathanw 521.3Schristos##### gdb/lib/libiberty ##### 531.1Snathanw 541.1Snathanwget_gdb_libiberty () { 551.3Schristos local _IBERTY=$_GDB/lib/libiberty 561.3Schristos mkdir -p $_TOP/$_IBERTY/arch/$MACHINE_ARCH 571.1Snathanw 581.1Snathanw getvars libiberty/Makefile \ 591.1Snathanw ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ 601.3Schristos | write_mk $_IBERTY/arch/$MACHINE_ARCH/defs.mk 611.1Snathanw 621.3Schristos write_c $_IBERTY/arch/$MACHINE_ARCH/config.h \ 631.1Snathanw <$_TMPDIR/libiberty/config.h 641.1Snathanw} 651.1Snathanw 661.3Schristos##### gdb/lib/libreadline ##### 671.1Snathanw 681.1Snathanwget_gdb_libreadline () { 691.3Schristos local _READLINE=$_GDB/lib/libreadline 701.3Schristos mkdir -p $_TOP/$_READLINE/arch/$MACHINE_ARCH 711.1Snathanw 721.1Snathanw { 731.1Snathanw getvars readline/Makefile \ 741.1Snathanw CCFLAGS OBJECTS 751.3Schristos } | write_mk $_READLINE/arch/$MACHINE_ARCH/defs.mk 761.3Schristos 771.3Schristos write_c $_READLINE/arch/$MACHINE_ARCH/config.h \ 781.3Schristos <$_TMPDIR/readline/config.h 791.3Schristos} 801.3Schristos 811.3Schristos##### gdb/lib/libdecnumber ##### 821.3Schristos 831.3Schristosget_gdb_libdecnumber () { 841.3Schristos local _DECNUMBER=$_GDB/lib/libdecnumber 851.3Schristos mkdir -p $_TOP/$_DECNUMBER/arch/$MACHINE_ARCH 861.3Schristos 871.3Schristos getvars libdecnumber/Makefile \ 881.3Schristos libdecnumber_a_OBJS | 891.3Schristos sed -e s/libdecnumber_a_// | 901.3Schristos write_mk $_DECNUMBER/arch/$MACHINE_ARCH/defs.mk 911.1Snathanw 921.3Schristos write_c $_DECNUMBER/arch/$MACHINE_ARCH/config.h \ 931.1Snathanw <$_TMPDIR/readline/config.h 941.3Schristos 951.3Schristos write_c $_DECNUMBER/arch/$MACHINE_ARCH/gstdint.h \ 961.3Schristos < $_TMPDIR/libdecnumber/gstdint.h 971.1Snathanw} 981.1Snathanw 991.3Schristos##### gdb/lib/libgdb ##### 1001.1Snathanw 1011.3Schristosget_gdb_libgdb () { 1021.3Schristos local _GDBP=$_GDB/lib/libgdb 1031.3Schristos mkdir -p $_TOP/$_GDBP/arch/$MACHINE_ARCH 1041.1Snathanw 1051.1Snathanw { 1061.1Snathanw getvars gdb/Makefile \ 1071.1Snathanw INTERNAL_CFLAGS LIBGDB_OBS SIM_OBS 1081.3Schristos } | write_mk $_GDBP/arch/$MACHINE_ARCH/defs.mk 1091.1Snathanw 1101.1Snathanw# getvars gdb/gdbserver/Makefile \ 1111.1Snathanw# INTERNAL_CFLAGS OBS \ 1121.3Schristos# | write_mk $_GDB/bin/gdb/arch/$MACHINE_ARCH/gdbserver.mk 1131.1Snathanw 1141.3Schristos for i in config.h observer.h observer.inc version.c init.c xml-builtin.c 1151.3Schristos do 1161.3Schristos write_c $_GDBP/arch/$MACHINE_ARCH/$i \ 1171.3Schristos < $_TMPDIR/gdb/$i 1181.1Snathanw done 1191.1Snathanw 1201.1Snathanw for f in nm tm xm; do 1211.1Snathanw if [ -f $_TMPDIR/gdb/$f.h ]; then 1221.1Snathanw ls -l $_TMPDIR/gdb/$f.h | sed 's,^.*->.*/gdb/,,;s,^,#include <,;s,$,>,' \ 1231.3Schristos | write_c $_GDBP/arch/$MACHINE_ARCH/$f.h 1241.1Snathanw fi 1251.1Snathanw done 1261.1Snathanw 1271.3Schristos local _LIBSIM=$_GDB/lib/libsim 1281.1Snathanw case $MACHINE_ARCH in 1291.1Snathanw powerpc*) 1301.3Schristos mkdir -p $_LIBSIM/arch/$MACHINE_ARCH 1311.3Schristos write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \ 1321.1Snathanw <$_TMPDIR/sim/ppc/config.h 1331.4Schristos write_c $_LIBSIM/arch/$MACHINE_ARCH/build-config.h \ 1341.4Schristos <$_TMPDIR/sim/ppc/build-config.h 1351.3Schristos write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \ 1361.1Snathanw <$_TMPDIR/sim/common/cconfig.h 1371.1Snathanw ;; 1381.2Schs xxmips*) 1391.3Schristos mkdir -p $_LIBSIM/arch/$MACHINE_ARCH 1401.3Schristos write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \ 1411.1Snathanw <$_TMPDIR/sim/mips/config.h 1421.3Schristos write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \ 1431.1Snathanw <$_TMPDIR/sim/common/cconfig.h 1441.1Snathanw { 1451.1Snathanw getvars sim/mips/Makefile \ 1461.1Snathanw LIB_OBJS CONFIG_CFLAGS \ 1471.1Snathanw BUILT_SRC_FROM_IGEN IGEN_OBJS 1481.3Schristos } | write_mk $_LIBSIM/arch/$MACHINE_ARCH/defs.mk 1491.1Snathanw ;; 1501.1Snathanw *) 1511.1Snathanw ;; 1521.1Snathanw esac 1531.1Snathanw} 1541.1Snathanw 1551.1Snathanw##### main ##### 1561.1Snathanw 1571.1Snathanwcase $1 in 1581.1Snathanwall|gdb) # everything (uses "canadian cross" temp environment) 1591.3Schristos get_gdb_libgdb 1601.1Snathanw get_gdb_libbfd 1611.1Snathanw get_gdb_libopcodes 1621.1Snathanw get_gdb_libiberty 1631.1Snathanw get_gdb_libreadline 1641.3Schristos get_gdb_libdecnumber 1651.1Snathanw exit 0 1661.1Snathanw ;; 1671.1Snathanw 1681.1Snathanw*) echo invalid arguments; exit 1;; 1691.1Snathanwesac 170