summaryrefslogtreecommitdiffstats
path: root/rules/gdb.make
blob: fe9b779c08162efc2d62f432272b08150f79c85b (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# -*-makefile-*-
# $Id: gdb.make,v 1.2 2003/10/07 07:13:43 robert Exp $
#
# (c) 2003 by Auerswald GmbH & Co. KG, Schandelah, Germany
# (c) 2002 by Pengutronix e.K., Hildesheim, 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.
#

#
# We provide this package
#
ifeq (y, $(PTXCONF_BUILD_GDB))
PACKAGES += gdb
endif
ifeq (y, $(PTXCONF_BUILD_GDBSERVER))
PACKAGES += gdb
endif

#
# Paths and names 
#
GDB_VERSION		= $(XGDB_VERSION)
GDB			= gdb-$(GDB_VERSION)
GDB_SUFFIX		= $(XGDB_SUFFIX)
GDB_SOURCE		= $(XGDB_SOURCE)
GDB_DIR			= $(BUILDDIR)/$(GDB)

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

gdb_get: $(STATEDIR)/xchain-gdb.get
	
# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

gdb_extract: $(STATEDIR)/gdb.extract

$(STATEDIR)/gdb.extract: $(STATEDIR)/xchain-gdb.get
	@$(call targetinfo, gdb.extract)
	@$(call clean, $(GDB_DIR))
	@$(call extract, $(GDB_SOURCE))
	touch $@

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

gdb_prepare: $(STATEDIR)/gdb.prepare

GDB_PATH	=  PATH=$(CROSS_PATH)
GDB_ENV		=  $(CROSS_ENV)

#
# autoconf
#
GDB_AUTOCONF	=  --prefix=$(PTXCONF_PREFIX)
GDB_AUTOCONF	+= --build=$(GNU_HOST)
GDB_AUTOCONF	+= --host=$(PTXCONF_GNU_TARGET)
GDB_AUTOCONF	+= --target=$(PTXCONF_GNU_TARGET)

$(STATEDIR)/gdb.prepare: $(STATEDIR)/gdb.extract
	@$(call targetinfo, gdb.prepare)

ifeq (y,$(PTXCONF_BUILD_GDB))
	cd $(GDB_DIR) && 						\
		$(GDB_PATH) $(GDB_ENV) ./configure $(GDB_AUTOCONF)
endif

ifeq (y,$(PTXCONF_BUILD_GDBSERVER))
	# configure is not executable, so run it with sh
	cd $(GDB_DIR)/gdb/gdbserver &&					\
		$(GDB_PATH) $(GDB_ENV) /bin/sh configure $(GDB_AUTOCONF)
endif
	touch $@

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

gdb_compile: $(STATEDIR)/gdb.compile

$(STATEDIR)/gdb.compile: $(STATEDIR)/gdb.prepare 
	@$(call targetinfo, gdb.compile)
	
ifeq (y,$(PTXCONF_BUILD_GDB))
	cd $(GDB_DIR) && \
		$(GDB_PATH) $(GDB_ENV) make 
endif

ifeq (y,$(PTXCONF_BUILD_GDBSERVER))
	cd $(GDB_DIR)/gdb/gdbserver && \
		$(GDB_PATH) $(GDB_ENV) make
endif
	touch $@

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

gdb_install: $(STATEDIR)/gdb.install

$(STATEDIR)/gdb.install: $(STATEDIR)/gdb.compile
	@$(call targetinfo, gdb.install)
	touch $@

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

gdb_targetinstall: $(STATEDIR)/gdb.targetinstall

$(STATEDIR)/gdb.targetinstall: $(STATEDIR)/gdb.install
	@$(call targetinfo, gdb.targetinstall)
	
ifeq (y,$(PTXCONF_BUILD_GDB))
	install $(GDB_DIR)/gdb/gdb $(ROOTDIR)/bin
	$(CROSSSTRIP) -R .notes -R .comment $(ROOTDIR)/bin/gdb
endif

ifeq (y,$(PTXCONF_BUILD_GDBSERVER))
	install $(GDB_DIR)/gdb/gdbserver/gdbserver $(ROOTDIR)/bin
	$(CROSSSTRIP) -R .notes -R .comment $(ROOTDIR)/bin/gdbserver
endif
	touch $@

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

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

# vim: syntax=make