mknative-gdb revision 1.5 1 1.1 nathanw #!/bin/sh
2 1.5 christos # $NetBSD: mknative-gdb,v 1.5 2011/11/06 19:46:12 christos Exp $
3 1.1 nathanw #
4 1.1 nathanw # Shell script for generating all the constants needed for a native
5 1.3 christos # platform build of src/external/gpl3/gdb
6 1.1 nathanw #
7 1.1 nathanw
8 1.1 nathanw # initialise
9 1.1 nathanw
10 1.1 nathanw _TMPDIR=$2
11 1.1 nathanw _TOP=$3
12 1.1 nathanw _PLATFORM=$4
13 1.1 nathanw _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
14 1.3 christos _GDB=external/gpl3/gdb
15 1.1 nathanw
16 1.1 nathanw . $_TOP/tools/gcc/mknative.common
17 1.1 nathanw
18 1.3 christos ##### gdb/lib/libbfd #####
19 1.1 nathanw
20 1.1 nathanw get_gdb_libbfd () {
21 1.3 christos local _BFD=$_GDB/lib/libbfd
22 1.3 christos mkdir -p $_TOP/$_BFD/arch/$MACHINE_ARCH
23 1.1 nathanw
24 1.1 nathanw {
25 1.1 nathanw getvars bfd/Makefile \
26 1.1 nathanw libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
27 1.1 nathanw INCLUDES TDEFAULTS
28 1.3 christos } | write_mk $_BFD/arch/$MACHINE_ARCH/defs.mk
29 1.1 nathanw
30 1.3 christos for i in bfd-in3.h bfd_stdint.h config.h bfd.h bfdver.h targmatch.h
31 1.3 christos do
32 1.3 christos write_c $_BFD/arch/$MACHINE_ARCH/$i <$_TMPDIR/bfd/$i
33 1.3 christos done
34 1.1 nathanw }
35 1.1 nathanw
36 1.3 christos ##### gdb/lib/libopcodes #####
37 1.1 nathanw
38 1.1 nathanw get_gdb_libopcodes () {
39 1.3 christos local _OPCODES=$_GDB/lib/libopcodes
40 1.3 christos mkdir -p $_TOP/$_OPCODES/arch/$MACHINE_ARCH
41 1.1 nathanw
42 1.1 nathanw {
43 1.1 nathanw getvars opcodes/Makefile \
44 1.1 nathanw archdefs BFD_MACHINES libopcodes_la_SOURCES
45 1.3 christos } | write_mk $_GDB/lib/libopcodes//arch/$MACHINE_ARCH/defs.mk
46 1.1 nathanw
47 1.1 nathanw {
48 1.1 nathanw cat $_TMPDIR/opcodes/config.h
49 1.3 christos } | write_c $_OPCODES/arch/$MACHINE_ARCH/config.h
50 1.1 nathanw }
51 1.1 nathanw
52 1.3 christos ##### gdb/lib/libiberty #####
53 1.1 nathanw
54 1.1 nathanw get_gdb_libiberty () {
55 1.3 christos local _IBERTY=$_GDB/lib/libiberty
56 1.3 christos mkdir -p $_TOP/$_IBERTY/arch/$MACHINE_ARCH
57 1.1 nathanw
58 1.1 nathanw getvars libiberty/Makefile \
59 1.1 nathanw ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
60 1.3 christos | write_mk $_IBERTY/arch/$MACHINE_ARCH/defs.mk
61 1.1 nathanw
62 1.3 christos write_c $_IBERTY/arch/$MACHINE_ARCH/config.h \
63 1.1 nathanw <$_TMPDIR/libiberty/config.h
64 1.1 nathanw }
65 1.1 nathanw
66 1.3 christos ##### gdb/lib/libreadline #####
67 1.1 nathanw
68 1.1 nathanw get_gdb_libreadline () {
69 1.3 christos local _READLINE=$_GDB/lib/libreadline
70 1.3 christos mkdir -p $_TOP/$_READLINE/arch/$MACHINE_ARCH
71 1.1 nathanw
72 1.1 nathanw {
73 1.1 nathanw getvars readline/Makefile \
74 1.1 nathanw CCFLAGS OBJECTS
75 1.3 christos } | write_mk $_READLINE/arch/$MACHINE_ARCH/defs.mk
76 1.3 christos
77 1.3 christos write_c $_READLINE/arch/$MACHINE_ARCH/config.h \
78 1.3 christos <$_TMPDIR/readline/config.h
79 1.3 christos }
80 1.3 christos
81 1.3 christos ##### gdb/lib/libdecnumber #####
82 1.3 christos
83 1.3 christos get_gdb_libdecnumber () {
84 1.3 christos local _DECNUMBER=$_GDB/lib/libdecnumber
85 1.3 christos mkdir -p $_TOP/$_DECNUMBER/arch/$MACHINE_ARCH
86 1.3 christos
87 1.3 christos getvars libdecnumber/Makefile \
88 1.3 christos libdecnumber_a_OBJS |
89 1.3 christos sed -e s/libdecnumber_a_// |
90 1.3 christos write_mk $_DECNUMBER/arch/$MACHINE_ARCH/defs.mk
91 1.1 nathanw
92 1.3 christos write_c $_DECNUMBER/arch/$MACHINE_ARCH/config.h \
93 1.1 nathanw <$_TMPDIR/readline/config.h
94 1.3 christos
95 1.3 christos write_c $_DECNUMBER/arch/$MACHINE_ARCH/gstdint.h \
96 1.3 christos < $_TMPDIR/libdecnumber/gstdint.h
97 1.1 nathanw }
98 1.1 nathanw
99 1.3 christos ##### gdb/lib/libgdb #####
100 1.1 nathanw
101 1.3 christos get_gdb_libgdb () {
102 1.3 christos local _GDBP=$_GDB/lib/libgdb
103 1.3 christos mkdir -p $_TOP/$_GDBP/arch/$MACHINE_ARCH
104 1.1 nathanw
105 1.1 nathanw {
106 1.1 nathanw getvars gdb/Makefile \
107 1.1 nathanw INTERNAL_CFLAGS LIBGDB_OBS SIM_OBS
108 1.3 christos } | write_mk $_GDBP/arch/$MACHINE_ARCH/defs.mk
109 1.1 nathanw
110 1.1 nathanw # getvars gdb/gdbserver/Makefile \
111 1.1 nathanw # INTERNAL_CFLAGS OBS \
112 1.3 christos # | write_mk $_GDB/bin/gdb/arch/$MACHINE_ARCH/gdbserver.mk
113 1.1 nathanw
114 1.3 christos for i in config.h observer.h observer.inc version.c init.c xml-builtin.c
115 1.3 christos do
116 1.3 christos write_c $_GDBP/arch/$MACHINE_ARCH/$i \
117 1.3 christos < $_TMPDIR/gdb/$i
118 1.1 nathanw done
119 1.1 nathanw
120 1.1 nathanw for f in nm tm xm; do
121 1.1 nathanw if [ -f $_TMPDIR/gdb/$f.h ]; then
122 1.1 nathanw ls -l $_TMPDIR/gdb/$f.h | sed 's,^.*->.*/gdb/,,;s,^,#include <,;s,$,>,' \
123 1.3 christos | write_c $_GDBP/arch/$MACHINE_ARCH/$f.h
124 1.1 nathanw fi
125 1.1 nathanw done
126 1.1 nathanw
127 1.3 christos local _LIBSIM=$_GDB/lib/libsim
128 1.1 nathanw case $MACHINE_ARCH in
129 1.1 nathanw powerpc*)
130 1.5 christos mkdir -p $_TOP/$_LIBSIM/arch/$MACHINE_ARCH
131 1.3 christos write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \
132 1.1 nathanw <$_TMPDIR/sim/ppc/config.h
133 1.4 christos write_c $_LIBSIM/arch/$MACHINE_ARCH/build-config.h \
134 1.4 christos <$_TMPDIR/sim/ppc/build-config.h
135 1.3 christos write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \
136 1.1 nathanw <$_TMPDIR/sim/common/cconfig.h
137 1.1 nathanw ;;
138 1.5 christos xxmips*) # Disabled for now
139 1.5 christos mkdir -p $_TOP/$_LIBSIM/arch/$MACHINE_ARCH
140 1.3 christos write_c $_LIBSIM/arch/$MACHINE_ARCH/config.h \
141 1.1 nathanw <$_TMPDIR/sim/mips/config.h
142 1.3 christos write_c $_LIBSIM/arch/$MACHINE_ARCH/cconfig.h \
143 1.1 nathanw <$_TMPDIR/sim/common/cconfig.h
144 1.1 nathanw {
145 1.1 nathanw getvars sim/mips/Makefile \
146 1.1 nathanw LIB_OBJS CONFIG_CFLAGS \
147 1.1 nathanw BUILT_SRC_FROM_IGEN IGEN_OBJS
148 1.3 christos } | write_mk $_LIBSIM/arch/$MACHINE_ARCH/defs.mk
149 1.1 nathanw ;;
150 1.1 nathanw *)
151 1.1 nathanw ;;
152 1.1 nathanw esac
153 1.1 nathanw }
154 1.1 nathanw
155 1.1 nathanw ##### main #####
156 1.1 nathanw
157 1.1 nathanw case $1 in
158 1.1 nathanw all|gdb) # everything (uses "canadian cross" temp environment)
159 1.3 christos get_gdb_libgdb
160 1.1 nathanw get_gdb_libbfd
161 1.1 nathanw get_gdb_libopcodes
162 1.1 nathanw get_gdb_libiberty
163 1.1 nathanw get_gdb_libreadline
164 1.3 christos get_gdb_libdecnumber
165 1.1 nathanw exit 0
166 1.1 nathanw ;;
167 1.1 nathanw
168 1.1 nathanw *) echo invalid arguments; exit 1;;
169 1.1 nathanw esac
170