1 ######################################################################
5 ######################################################################
6 GDB_VERSION:=$(strip $(GDB_VERSION))
8 GDB_SITE:=http://ftp.gnu.org/gnu/gdb
10 ifeq ($(GDB_VERSION),5.3)
11 GDB_SOURCE:=gdb-$(GDB_VERSION).tar.gz
14 GDB_SOURCE:=gdb-$(GDB_VERSION).tar.bz2
18 GDB_DIR:=$(TOOL_BUILD_DIR)/gdb-$(GDB_VERSION)
20 $(DL_DIR)/$(GDB_SOURCE):
21 $(WGET) -P $(DL_DIR) $(GDB_SITE)/$(GDB_SOURCE)
23 $(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
24 $(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
25 toolchain/patch-kernel.sh $(GDB_DIR) toolchain/gdb/$(GDB_VERSION) \*.patch
26 # Copy a config.sub from gcc. This is only necessary until
27 # gdb's config.sub supports <arch>-linux-uclibc tuples.
28 # Should probably integrate this into the patch.
29 ifeq ($(GDB_VERSION),5.3)
30 chmod u+x $(GDB_DIR)/gdb/gdbserver/configure
31 cp $(GCC_DIR)/config.sub $(GDB_DIR)
32 cp $(GCC_DIR)/config.sub $(GDB_DIR)/readline/support/
34 touch $(GDB_DIR)/.unpacked
36 ######################################################################
40 ######################################################################
42 GDB_TARGET_DIR:=$(BUILD_DIR)/gdb-$(GDB_VERSION)-target
44 GDB_TARGET_CONFIGURE_VARS:= \
45 ac_cv_type_uintptr_t=yes \
46 gt_cv_func_gettext_libintl=yes \
47 ac_cv_func_dcgettext=yes \
48 gdb_cv_func_sigsetjmp=yes \
49 bash_cv_func_strcoll_broken=no \
50 bash_cv_must_reinstall_sighandlers=no \
51 bash_cv_func_sigsetjmp=present \
52 bash_cv_have_mbstate_t=yes
54 $(GDB_TARGET_DIR)/.configured: $(GDB_DIR)/.unpacked
55 mkdir -p $(GDB_TARGET_DIR)
56 (cd $(GDB_TARGET_DIR); \
57 gdb_cv_func_sigsetjmp=yes \
58 $(TARGET_CONFIGURE_OPTS) \
59 CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
60 $(GDB_TARGET_CONFIGURE_VARS) \
61 $(GDB_DIR)/configure \
62 --build=$(GNU_HOST_NAME) \
63 --host=$(REAL_GNU_TARGET_NAME) \
64 --target=$(REAL_GNU_TARGET_NAME) \
67 --without-uiout --disable-gdbmi \
68 --disable-tui --disable-gdbtk --without-x \
69 --disable-sim --enable-gdbserver \
70 --without-included-gettext \
72 ifeq ($(ENABLE_LOCALE),true)
73 -$(SED) "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile
75 touch $(GDB_TARGET_DIR)/.configured
77 $(GDB_TARGET_DIR)/gdb/gdb: $(GDB_TARGET_DIR)/.configured
78 $(MAKE) CC=$(TARGET_CC) MT_CFLAGS="$(TARGET_CFLAGS)" \
80 $(STRIP) $(GDB_TARGET_DIR)/gdb/gdb
82 $(TARGET_DIR)/usr/bin/gdb: $(GDB_TARGET_DIR)/gdb/gdb
83 install -c $(GDB_TARGET_DIR)/gdb/gdb $(TARGET_DIR)/usr/bin/gdb
85 gdb_target: ncurses-headers $(TARGET_DIR)/usr/bin/gdb
87 gdb_target-source: $(DL_DIR)/$(GDB_SOURCE)
90 $(MAKE) -C $(GDB_DIR) clean
95 ######################################################################
99 ######################################################################
101 GDB_SERVER_DIR:=$(BUILD_DIR)/gdbserver-$(GDB_VERSION)
103 $(GDB_SERVER_DIR)/.configured: $(GDB_DIR)/.unpacked
104 mkdir -p $(GDB_SERVER_DIR)
105 (cd $(GDB_SERVER_DIR); \
106 $(TARGET_CONFIGURE_OPTS) \
107 gdb_cv_func_sigsetjmp=yes \
108 $(GDB_DIR)/gdb/gdbserver/configure \
109 --build=$(GNU_HOST_NAME) \
110 --host=$(REAL_GNU_TARGET_NAME) \
111 --target=$(REAL_GNU_TARGET_NAME) \
115 --sbindir=/usr/sbin \
116 --libexecdir=/usr/lib \
118 --datadir=/usr/share \
119 --localstatedir=/var \
121 --infodir=/usr/info \
122 --includedir=$(STAGING_DIR)/include \
124 --without-uiout --disable-gdbmi \
125 --disable-tui --disable-gdbtk --without-x \
126 --without-included-gettext \
128 touch $(GDB_SERVER_DIR)/.configured
130 $(GDB_SERVER_DIR)/gdbserver: $(GDB_SERVER_DIR)/.configured
131 $(MAKE) CC=$(TARGET_CC) MT_CFLAGS="$(TARGET_CFLAGS)" \
133 $(STRIP) $(GDB_SERVER_DIR)/gdbserver
135 $(TARGET_DIR)/usr/bin/gdbserver: $(GDB_SERVER_DIR)/gdbserver
136 install -c $(GDB_SERVER_DIR)/gdbserver $(TARGET_DIR)/usr/bin/gdbserver
138 gdbserver: ncurses-headers $(TARGET_DIR)/usr/bin/gdbserver
141 $(MAKE) -C $(GDB_SERVER_DIR) clean
144 rm -rf $(GDB_SERVER_DIR)
146 ######################################################################
150 ######################################################################
152 GDB_CLIENT_DIR:=$(TOOL_BUILD_DIR)/gdbclient-$(GDB_VERSION)
154 $(GDB_CLIENT_DIR)/.configured: $(GDB_DIR)/.unpacked
155 mkdir -p $(GDB_CLIENT_DIR)
156 (cd $(GDB_CLIENT_DIR); \
157 gdb_cv_func_sigsetjmp=yes \
158 $(GDB_DIR)/configure \
159 --prefix=$(STAGING_DIR) \
160 --build=$(GNU_HOST_NAME) \
161 --host=$(GNU_HOST_NAME) \
162 --target=$(REAL_GNU_TARGET_NAME) \
164 --without-uiout --disable-gdbmi \
165 --disable-tui --disable-gdbtk --without-x \
166 --without-included-gettext \
169 touch $(GDB_CLIENT_DIR)/.configured
171 $(GDB_CLIENT_DIR)/gdb/gdb: $(GDB_CLIENT_DIR)/.configured
172 $(MAKE) -C $(GDB_CLIENT_DIR)
173 strip $(GDB_CLIENT_DIR)/gdb/gdb
175 $(TARGET_CROSS)gdb: $(GDB_CLIENT_DIR)/gdb/gdb
176 install -c $(GDB_CLIENT_DIR)/gdb/gdb $(TARGET_CROSS)gdb
177 ln -s ../../bin/$(REAL_GNU_TARGET_NAME)-gdb \
178 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/gdb
180 gdbclient: $(TARGET_CROSS)gdb
183 $(MAKE) -C $(GDB_CLIENT_DIR) clean
186 rm -rf $(GDB_CLIENT_DIR)