summaryrefslogtreecommitdiffstats
path: root/rules/gdb-wrapper.make
blob: 9b647357d0085b5fbdb1cc110a35087f325db171 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2002 by Pengutronix e.K., Hildesheim, Germany
# Copyright (C) 2003 by Auerswald GmbH & Co. KG, Schandelah, Germany
#
# See CREDITS for details about who has contributed to this project. 
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

# FIXME: RSC: what's the purpose of that? 

#
# We provide this package
#
PACKAGES-$(PTXCONF_GDB_WRAPPER) += gdb-wrapper


# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

gdb-wrapper_get: $(STATEDIR)/gdb-wrapper.get

$(STATEDIR)/gdb-wrapper.get: $(gdb_wrapper_get_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

gdb-wrapper_extract: $(STATEDIR)/gdb-wrapper.extract

$(STATEDIR)/gdb-wrapper.extract: $(gdb_wrapper_extract_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

gdb-wrapper_prepare: $(STATEDIR)/gdb-wrapper.prepare

$(STATEDIR)/gdb-wrapper.prepare: $(gdb_wrapper_prepare_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

gdb-wrapper_compile: $(STATEDIR)/gdb-wrapper.compile

$(STATEDIR)/gdb-wrapper.compile: $(gdb_wrapper_compile_deps_default)
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

gdb-wrapper_install: $(STATEDIR)/gdb-wrapper.install

$(STATEDIR)/gdb-wrapper.install: $(gdb_wrapper_install_deps_default)
	@$(call targetinfo, $@)

	# let gdb find the target libraries for remote cross debugging
	install -d $(PTXCONF_PREFIX)/etc
	rm -f $(PTXCONF_PREFIX)/etc/gdbrc
	echo "set solib-search-path $(ROOTDIR)/lib:$(ROOTDIR)/usr/lib" >> $(PTXCONF_PREFIX)/etc/gdbrc
	echo "set solib-absolute-prefix $(ROOTDIR)" >> $(PTXCONF_PREFIX)/etc/gdbrc

	# make gdb wrapper
	install -d $(PTXCONF_PREFIX)/bin
	rm -f $(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossgdb
	echo "#!/bin/sh" >> \
		$(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossgdb
	echo "$(PTXCONF_GNU_TARGET)-gdb -x $(PTXCONF_PREFIX)/etc/gdbrc \$$@" >> \
		$(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossgdb
	chmod 755 $(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossgdb

	# make ddd wrapper
	rm -f $(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossddd
	echo "#!/bin/sh" >> \
		$(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossddd
	echo "ddd --debugger $(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossgdb \$$@" >> \
		$(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossddd
	chmod 755 $(PTXCONF_PREFIX)/bin/$(PTXCONF_GNU_TARGET)-crossddd

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

gdb-wrapper_targetinstall: $(gdb_wrapper_targetinstall_defaults)

$(STATEDIR)/gdb-wrapper.targetinstall: $(STATEDIR)/gdb-wrapper.compile
	@$(call targetinfo, $@)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

gdb-wrapper_clean: 
	rm -rf $(STATEDIR)/gdb-wrapper.* $(GDB_DIR)

# vim: syntax=make