mknative-gdb revision 1.2
11.1Snathanw#!/bin/sh 21.2Schs# $NetBSD: mknative-gdb,v 1.2 2007/02/19 18:26:22 chs Exp $ 31.1Snathanw# 41.1Snathanw# Shell script for generating all the constants needed for a native 51.1Snathanw# platform build of src/gnu/dist/gdb6. 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.1Snathanw 151.1Snathanw. $_TOP/tools/gcc/mknative.common 161.1Snathanw 171.1Snathanw##### gnu/usr.bin/gdb6/bfd ##### 181.1Snathanw 191.1Snathanwget_gdb_libbfd () { 201.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH 211.1Snathanw 221.1Snathanw { 231.1Snathanw getvars bfd/Makefile \ 241.1Snathanw libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \ 251.1Snathanw INCLUDES TDEFAULTS 261.1Snathanw } | write_mk gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/defs.mk 271.1Snathanw 281.1Snathanw write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/bfd.h <$_TMPDIR/bfd/bfd.h 291.1Snathanw write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/bfdver.h <$_TMPDIR/bfd/bfdver.h 301.1Snathanw 311.1Snathanw { 321.1Snathanw cat $_TMPDIR/bfd/config.h 331.1Snathanw } | write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/config.h 341.1Snathanw} 351.1Snathanw 361.1Snathanw##### gnu/lib/opcodes ##### 371.1Snathanw 381.1Snathanwget_gdb_libopcodes () { 391.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH 401.1Snathanw 411.1Snathanw { 421.1Snathanw getvars opcodes/Makefile \ 431.1Snathanw archdefs BFD_MACHINES libopcodes_la_SOURCES 441.1Snathanw } | write_mk gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH/defs.mk 451.1Snathanw 461.1Snathanw { 471.1Snathanw cat $_TMPDIR/opcodes/config.h 481.1Snathanw } | write_c gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH/config.h 491.1Snathanw} 501.1Snathanw 511.1Snathanw##### gnu/lib/libiberty ##### 521.1Snathanw 531.1Snathanwget_gdb_libiberty () { 541.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH 551.1Snathanw 561.1Snathanw getvars libiberty/Makefile \ 571.1Snathanw ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ 581.1Snathanw | write_mk gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH/defs.mk 591.1Snathanw 601.1Snathanw write_c gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH/config.h \ 611.1Snathanw <$_TMPDIR/libiberty/config.h 621.1Snathanw} 631.1Snathanw 641.1Snathanw##### gnu/usr.bin/gdb6/readline ##### 651.1Snathanw 661.1Snathanwget_gdb_libreadline () { 671.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH 681.1Snathanw 691.1Snathanw { 701.1Snathanw getvars readline/Makefile \ 711.1Snathanw CCFLAGS OBJECTS 721.1Snathanw } | write_mk gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH/defs.mk 731.1Snathanw 741.1Snathanw write_c gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH/config.h \ 751.1Snathanw <$_TMPDIR/readline/config.h 761.1Snathanw} 771.1Snathanw 781.1Snathanw##### gnu/usr.bin/gdb6 ##### 791.1Snathanw 801.1Snathanwget_gdb () { 811.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/arch/$MACHINE_ARCH 821.1Snathanw 831.1Snathanw { 841.1Snathanw getvars gdb/Makefile \ 851.1Snathanw INTERNAL_CFLAGS LIBGDB_OBS SIM_OBS 861.1Snathanw } | write_mk gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/defs.mk 871.1Snathanw 881.1Snathanw# getvars gdb/gdbserver/Makefile \ 891.1Snathanw# INTERNAL_CFLAGS OBS \ 901.1Snathanw# | write_mk gnu/usr.bin/gdb/arch/$MACHINE_ARCH/gdbserver.mk 911.1Snathanw 921.1Snathanw write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/config.h \ 931.1Snathanw < $_TMPDIR/gdb/config.h 941.1Snathanw 951.1Snathanw for f in init version; do 961.1Snathanw write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/$f.c <$_TMPDIR/gdb/$f.c 971.1Snathanw done 981.1Snathanw 991.1Snathanw for f in nm tm xm; do 1001.1Snathanw if [ -f $_TMPDIR/gdb/$f.h ]; then 1011.1Snathanw ls -l $_TMPDIR/gdb/$f.h | sed 's,^.*->.*/gdb/,,;s,^,#include <,;s,$,>,' \ 1021.1Snathanw | write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/$f.h 1031.1Snathanw fi 1041.1Snathanw done 1051.1Snathanw 1061.1Snathanw case $MACHINE_ARCH in 1071.1Snathanw powerpc*) 1081.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH 1091.1Snathanw write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/config.h \ 1101.1Snathanw <$_TMPDIR/sim/ppc/config.h 1111.1Snathanw write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/cconfig.h \ 1121.1Snathanw <$_TMPDIR/sim/common/cconfig.h 1131.1Snathanw ;; 1141.2Schs xxmips*) 1151.1Snathanw mkdir -p $_TOP/gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH 1161.1Snathanw write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/config.h \ 1171.1Snathanw <$_TMPDIR/sim/mips/config.h 1181.1Snathanw write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/cconfig.h \ 1191.1Snathanw <$_TMPDIR/sim/common/cconfig.h 1201.1Snathanw { 1211.1Snathanw getvars sim/mips/Makefile \ 1221.1Snathanw LIB_OBJS CONFIG_CFLAGS \ 1231.1Snathanw BUILT_SRC_FROM_IGEN IGEN_OBJS 1241.1Snathanw } | write_mk gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/defs.mk 1251.1Snathanw ;; 1261.1Snathanw *) 1271.1Snathanw ;; 1281.1Snathanw esac 1291.1Snathanw} 1301.1Snathanw 1311.1Snathanw##### main ##### 1321.1Snathanw 1331.1Snathanwcase $1 in 1341.1Snathanwall|gdb) # everything (uses "canadian cross" temp environment) 1351.1Snathanw get_gdb 1361.1Snathanw get_gdb_libbfd 1371.1Snathanw get_gdb_libopcodes 1381.1Snathanw get_gdb_libiberty 1391.1Snathanw get_gdb_libreadline 1401.1Snathanw exit 0 1411.1Snathanw ;; 1421.1Snathanw 1431.1Snathanw*) echo invalid arguments; exit 1;; 1441.1Snathanwesac 145