No empty .Rs/.Re
[netbsd-mini2440.git] / tools / gdb / mknative-gdb
blob8699b9be4e6bca7c222df285c470f09eba92ad64
1 #!/bin/sh
2 # $NetBSD: mknative-gdb,v 1.1 2006/05/29 19:10:58 nathanw Exp $
4 # Shell script for generating all the constants needed for a native
5 # platform build of src/gnu/dist/gdb6.
8 # initialise
10 _TMPDIR=$2
11 _TOP=$3
12 _PLATFORM=$4
13 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
15 . $_TOP/tools/gcc/mknative.common
17 ##### gnu/usr.bin/gdb6/bfd #####
19 get_gdb_libbfd () {
20 mkdir -p $_TOP/gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH
23 getvars bfd/Makefile \
24 libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
25 INCLUDES TDEFAULTS
26 } | write_mk gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/defs.mk
28 write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/bfd.h <$_TMPDIR/bfd/bfd.h
29 write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/bfdver.h <$_TMPDIR/bfd/bfdver.h
32 cat $_TMPDIR/bfd/config.h
33 } | write_c gnu/usr.bin/gdb6/bfd/arch/$MACHINE_ARCH/config.h
36 ##### gnu/lib/opcodes #####
38 get_gdb_libopcodes () {
39 mkdir -p $_TOP/gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH
42 getvars opcodes/Makefile \
43 archdefs BFD_MACHINES libopcodes_la_SOURCES
44 } | write_mk gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH/defs.mk
47 cat $_TMPDIR/opcodes/config.h
48 } | write_c gnu/usr.bin/gdb6/opcodes/arch/$MACHINE_ARCH/config.h
51 ##### gnu/lib/libiberty #####
53 get_gdb_libiberty () {
54 mkdir -p $_TOP/gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH
56 getvars libiberty/Makefile \
57 ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
58 | write_mk gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH/defs.mk
60 write_c gnu/usr.bin/gdb6/libiberty/arch/$MACHINE_ARCH/config.h \
61 <$_TMPDIR/libiberty/config.h
64 ##### gnu/usr.bin/gdb6/readline #####
66 get_gdb_libreadline () {
67 mkdir -p $_TOP/gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH
70 getvars readline/Makefile \
71 CCFLAGS OBJECTS
72 } | write_mk gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH/defs.mk
74 write_c gnu/usr.bin/gdb6/readline/arch/$MACHINE_ARCH/config.h \
75 <$_TMPDIR/readline/config.h
78 ##### gnu/usr.bin/gdb6 #####
80 get_gdb () {
81 mkdir -p $_TOP/gnu/usr.bin/gdb6/arch/$MACHINE_ARCH
84 getvars gdb/Makefile \
85 INTERNAL_CFLAGS LIBGDB_OBS SIM_OBS
86 } | write_mk gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/defs.mk
88 # getvars gdb/gdbserver/Makefile \
89 # INTERNAL_CFLAGS OBS \
90 # | write_mk gnu/usr.bin/gdb/arch/$MACHINE_ARCH/gdbserver.mk
92 write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/config.h \
93 < $_TMPDIR/gdb/config.h
95 for f in init version; do
96 write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/$f.c <$_TMPDIR/gdb/$f.c
97 done
99 for f in nm tm xm; do
100 if [ -f $_TMPDIR/gdb/$f.h ]; then
101 ls -l $_TMPDIR/gdb/$f.h | sed 's,^.*->.*/gdb/,,;s,^,#include <,;s,$,>,' \
102 | write_c gnu/usr.bin/gdb6/arch/$MACHINE_ARCH/$f.h
104 done
106 case $MACHINE_ARCH in
107 powerpc*)
108 mkdir -p $_TOP/gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH
109 write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/config.h \
110 <$_TMPDIR/sim/ppc/config.h
111 write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/cconfig.h \
112 <$_TMPDIR/sim/common/cconfig.h
114 xxmips*)
115 mkdir -p $_TOP/gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH
116 write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/config.h \
117 <$_TMPDIR/sim/mips/config.h
118 write_c gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/cconfig.h \
119 <$_TMPDIR/sim/common/cconfig.h
121 getvars sim/mips/Makefile \
122 LIB_OBJS CONFIG_CFLAGS \
123 BUILT_SRC_FROM_IGEN IGEN_OBJS
124 } | write_mk gnu/usr.bin/gdb6/sim/arch/$MACHINE_ARCH/defs.mk
128 esac
131 ##### main #####
133 case $1 in
134 all|gdb) # everything (uses "canadian cross" temp environment)
135 get_gdb
136 get_gdb_libbfd
137 get_gdb_libopcodes
138 get_gdb_libiberty
139 get_gdb_libreadline
140 exit 0
143 *) echo invalid arguments; exit 1;;
144 esac