summaryrefslogtreecommitdiffstats
path: root/openwrt/toolchain/gdb/Makefile
blob: 85dfa7164c9c9cb739c0fb2c798f97e5d5e5def3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# $Id$

include $(TOPDIR)/rules.mk

GDB_NAME:=gdb
GDB_SITE:=http://ftp.gnu.org/gnu/gdb
GDB_VERSION:=6.3
GDB_SOURCE:=$(GDB_NAME)-$(GDB_VERSION).tar.bz2
GDB_CAT:=bzcat

GDB_DIR:=$(TOOL_BUILD_DIR)/$(GDB_NAME)-$(GDB_VERSION)

$(DL_DIR)/$(GDB_SOURCE):
	$(WGET) -P $(DL_DIR) $(GDB_SITE)/$(GDB_SOURCE)

$(GDB_DIR)/.patched: $(DL_DIR)/$(GDB_SOURCE)
	$(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
	$(PATCH) $(GDB_DIR) ./patches
	# Copy a config.sub from gcc.  This is only necessary until
	# gdb's config.sub supports <arch>-linux-uclibc tuples.
	# Should probably integrate this into the patch.
	touch  $(GDB_DIR)/.patched

# gdb client

GDB_CLIENT_DIR:=$(TOOL_BUILD_DIR)/gdbclient-$(GDB_VERSION)

$(GDB_CLIENT_DIR)/.configured: $(GDB_DIR)/.patched
	mkdir -p $(GDB_CLIENT_DIR)
	(cd $(GDB_CLIENT_DIR); \
		gdb_cv_func_sigsetjmp=yes \
		$(GDB_DIR)/configure \
		--prefix=$(STAGING_DIR) \
		--build=$(GNU_HOST_NAME) \
		--host=$(GNU_HOST_NAME) \
		--target=$(REAL_GNU_TARGET_NAME) \
		$(DISABLE_NLS) \
		--without-uiout --disable-gdbmi \
		--disable-tui --disable-gdbtk --without-x \
		--without-included-gettext \
		--enable-threads \
	);
	touch  $(GDB_CLIENT_DIR)/.configured

$(GDB_CLIENT_DIR)/gdb/gdb: $(GDB_CLIENT_DIR)/.configured
	$(MAKE) -C $(GDB_CLIENT_DIR)
	strip $(GDB_CLIENT_DIR)/gdb/gdb

$(TARGET_CROSS)gdb: $(GDB_CLIENT_DIR)/gdb/gdb
	install -c $(GDB_CLIENT_DIR)/gdb/gdb $(TARGET_CROSS)gdb
	cd $(STAGING_DIR)/bin && \
	ln -fs $(GNU_TARGET_NAME)-gdb $(REAL_GNU_TARGET_NAME)-gdb

source: $(DL_DIR)/$(GDB_SOURCE)
prepare: $(GDB_DIR)/.patched
compile: 
install: $(TARGET_CROSS)gdb
clean:
	rm -rf $(GDB_CLIENT_DIR)