File: rules

package info (click to toggle)
gdb 7.12-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 216,152 kB
  • ctags: 304,881
  • sloc: ansic: 2,141,328; asm: 331,662; exp: 133,348; makefile: 57,698; sh: 23,586; yacc: 14,054; cpp: 12,262; perl: 5,300; python: 4,685; ada: 4,343; xml: 3,670; pascal: 3,120; lisp: 1,516; cs: 879; lex: 624; f90: 457; sed: 228; awk: 142; objc: 134; java: 73; fortran: 43
file content (362 lines) | stat: -rwxr-xr-x 12,089 bytes parent folder | download
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
#!/usr/bin/make -f

ALL_BUILDDIR := $(shell pwd)/build

DEB_BUILDDIR := $(ALL_BUILDDIR)/objdir
DEB_DH_INSTALL_SOURCEDIR := $(shell pwd)/debian/tmp
DEB_DH_STRIP_ARGS_gdb = --dbgsym-migration='gdb-dbg (<< 7.12-1~)'

# Override CDBS's default CFLAGS, which also includes -Wall; gdb
# does not handle -Wunused well with -Werror, but defaults to
# -Werror.
DEB_WARNING_FLAGS :=

# This implements the .deb package creation using debhelper.
include /usr/share/cdbs/1/rules/debhelper.mk

# This implements building using a configure script and Makefile.
include /usr/share/cdbs/1/class/python-autotools.mk

# The top-level configure script fails to pass these down properly ...
export CPPFLAGS
export LDFLAGS
CPPFLAGS += -fPIC

# Always install into debian/tmp, even if we are only building one package.
DEB_DESTDIR := $(shell pwd)/debian/tmp

install = /usr/bin/install -p

# Rather paranoid than sorry. Make the shell exit with an error if an
# untested command fails.
SHELL += -e

DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_TARGET_ARCH := $(shell dpkg-architecture -qDEB_TARGET_ARCH)
DEB_TARGET_GNU_TYPE := $(shell dpkg-architecture -qDEB_TARGET_GNU_TYPE)

# Cross configuration support.  Check for an environment variable
# $GDB_TARGET, or a file debian/target.
ifndef GDB_TARGET
DEBIAN_TARGET_FILE := $(strip $(shell cat debian/target 2>/dev/null))
ifneq ($(DEBIAN_TARGET_FILE),)
GDB_TARGET := $(DEBIAN_TARGET_FILE)
endif
endif

DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)

ifneq ($(GDB_TARGET),)
DEB_CONFIGURE_GDB_DATADIR := "\$${prefix}/share/gdb-$(DEB_TARGET_GNU_TYPE)"
DEB_CONFIGURE_PATH_ARGS += --with-gdb-datadir=$(DEB_CONFIGURE_GDB_DATADIR)
endif

ifeq ($(DEB_TARGET_ARCH),)
$(error GDB_TARGET value "$(GDB_TARGET)" is not a valid Debian architecture)
endif

ifdef GDB_TARGET
  DEB_CROSS = yes
  # TP: Target Prefix. Used primarily as a prefix for cross tool
  #     names (e.g. powerpc-linux-gcc).
  # TS: Target Suffix. Used primarily at the end of cross compiler
  #     package names (e.g. gcc-powerpc).
  TP = $(DEB_TARGET_ALIAS)-
  TS = -$(DEB_TARGET_ALIAS)
  CROSS_FORCE = FORCE
endif

distribution := $(shell lsb_release -is)
deb_version := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')

BUILDDIRMULTIARCH = $(ALL_BUILDDIR)/objdir-multiarch
BUILDDIRPYTHON2 = $(ALL_BUILDDIR)/objdir-python2

run_tests := yes

ifneq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
  run_tests := no
endif

ifeq (,$(findstring linux, $(DEB_HOST_GNU_SYSTEM)))
  run_tests := no
endif

ifeq ($(DEB_HOST_GNU_CPU),ia64)
  arch_config_args := --with-libunwind-ia64
endif

ifneq (,$(filter $(DEB_HOST_ARCH),amd64 armel armhf i386 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390x))
  arch_config_args += --with-babeltrace
endif

ifdef GDB_TARGET
  run_tests := no

  arch_config_args += --program-prefix=$(TP) \
    --target=$(DEB_TARGET_ALIAS) --with-sysroot=/usr/$(DEB_TARGET_ALIAS)
else
  # To avoid file conflicts, only enable the global gdbinit file for native
  # debuggers.
  arch_config_args += --with-system-gdbinit=/etc/gdb/gdbinit
endif

INSTALL = $(install)
export INSTALL

# We pass srcdir explicitly to avoid an extra '/.' at the end of it.  That
# causes a harmless, but ugly, testsuite failure in maint.exp.
EXTRA_FLAGS := --disable-gdbtk --disable-shared \
	--with-pkgversion='$(distribution) $(deb_version)' \
	--srcdir=$(shell pwd) \
	--disable-readline --with-system-readline --with-expat \
	--with-system-zlib --without-lzma \
	--without-guile --without-babeltrace \
	$(arch_config_args) --build=$(DEB_BUILD_GNU_TYPE)

# Debian does not include 64-bit Python packages, so --with-python
# is here rather than in EXTRA_FLAGS.
DEB_CONFIGURE_EXTRA_FLAGS := --host=$(DEB_HOST_GNU_TYPE) $(EXTRA_FLAGS) \
	--enable-tui --with-lzma --with-python=python3

# multiarch targets; this is taken from the binutils-multiarch package but
# doesn't seem like a terribly nice list; see
# <20110117211551.GA7216@bee.dooz.org> for discussion -- locally updated
MULTIARCH_TARGETS := \
	aarch64-linux-gnu \
	alpha-linux-gnu \
	arm-linux-gnu \
	arm-linux-gnueabi \
	arm-linux-gnueabihf \
	arm-none-eabi \
	hppa-linux-gnu \
	i686-linux-gnu \
	ia64-linux-gnu \
	m68k-linux-gnu \
	m68k-rtems \
	mips-linux-gnu \
	mipsel-linux-gnu \
	mips64-linux-gnu \
	mips64el-linux-gnu \
	powerpc-linux-gnu \
	powerpc-linux-gnuspe \
	powerpc64le-linux-gnu \
	powerpc64-linux-gnu \
	ppc64-linux-gnu \
	s390-linux-gnu \
	s390x-linux-gnu \
	sh-linux-gnu \
	sparc-linux-gnu \
	sparc64-linux-gnu \
	x86_64-linux-gnu \
	m32r-linux-gnu 

# broken, see https://launchpad.net/bugs/1233185
#MULTIARCH_TARGETS := all
#	--enable-targets=$(MULTIARCH_TARGETS) \
# multiarch flags
DEB_CONFIGURE_FLAGS_MULTIARCH := $(DEB_CONFIGURE_EXTRA_FLAGS) \
	--enable-64-bit-bfd \
	--enable-targets=`set -- $(MULTIARCH_TARGETS); IFS=,; echo "$$*"` \
	--disable-sim

# Minimal flags
DEB_CONFIGURE_FLAGS_MIN := --host=$(DEB_HOST_GNU_TYPE) $(EXTRA_FLAGS) \
	--disable-tui --without-python --without-babeltrace

DEB_CONFIGURE_FLAGS_PYTHON2 := $(DEB_CONFIGURE_EXTRA_FLAGS) \
	--with-python=python2

# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
COMMA = ,
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
  NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

DEB_MAKE_BUILD_TARGET = $(NJOBS) all

BUILDDIRSOURCE := $(ALL_BUILDDIR)/gdb
BUILDDIRMIN := $(ALL_BUILDDIR)/gdb-minimal

# This should probably be common-post-build-arch, but that runs during
# install, under fakeroot, in CDBS 0.4.21.
build/gdb$(TS):: check-stamp
	$(MAKE) -C $(DEB_BUILDDIR) info
	$(MAKE) -C $(DEB_BUILDDIR)/gdb/doc refcard.dvi refcard.ps

build/gdb-python2$(TS):: build-python2-stamp
build-python2-stamp:
	mkdir -p $(BUILDDIRPYTHON2)
	cd $(BUILDDIRPYTHON2) && CFLAGS="$(CFLAGS)" \
	  $(shell pwd)/configure $(DEB_CONFIGURE_NORMAL_ARGS) $(DEB_CONFIGURE_DEBUG_ARGS) $(DEB_CONFIGURE_FLAGS_PYTHON2)
	cd $(BUILDDIRPYTHON2) && $(DEB_MAKE_ENVVARS) $(MAKE) $(NJOBS)
	touch $@

build/gdb-multiarch:: build-multiarch-stamp
build-multiarch-stamp:
	mkdir -p $(BUILDDIRMULTIARCH)
	cd $(BUILDDIRMULTIARCH) && CFLAGS="$(CFLAGS)" \
	  $(shell pwd)/configure $(DEB_CONFIGURE_NORMAL_ARGS) $(DEB_CONFIGURE_DEBUG_ARGS) $(DEB_CONFIGURE_FLAGS_MULTIARCH)
	cd $(BUILDDIRMULTIARCH) && $(DEB_MAKE_ENVVARS) $(MAKE) $(NJOBS)
	touch $@

build/gdb-minimal:: build-minimal-stamp
build-minimal-stamp:
	mkdir -p $(BUILDDIRMIN)
	cd $(BUILDDIRMIN) && CFLAGS="$(CFLAGS)" \
	  $(shell pwd)/configure $(DEB_CONFIGURE_NORMAL_ARGS) $(DEB_CONFIGURE_DEBUG_ARGS) $(DEB_CONFIGURE_FLAGS_MIN)
	cd $(BUILDDIRMIN) && $(DEB_MAKE_ENVVARS) $(MAKE) $(NJOBS)
	touch $@

check-stamp:
ifeq ($(run_tests),yes)
	$(MAKE) $(NJOBS) -C $(DEB_BUILDDIR)/gdb check \
	  || echo "**Tests failed, of course.**"
endif
	touch $@

clean::
	rm -f check-stamp build-multiarch-stamp
	rm -f debian/files
	rm -rf $(ALL_BUILDDIR)

	if test -f gdb/version.in.backup; then \
	  mv -f gdb/version.in.backup gdb/version.in; \
	fi

#	# For snapshots this is appropriate; careful of release tarballs
#	# which include .gmo files.
#	find -type f -name '*.gmo' | xargs rm -f

	# Prevent gratuitous rebuilds of the BFD documentation, since it
	# updates the copy in the source directory.
	find bfd -name bfd.info\* | xargs --no-run-if-empty touch

binary-post-install/gdb$(TS) ::
	if [ -x debian/tmp/usr/bin/run ]; then \
		mv debian/tmp/usr/bin/run \
		  debian/gdb$(TS)/usr/bin/$(DEB_TARGET_ALIAS)-run; \
	fi
	if [ -r debian/tmp/usr/share/man/man1/run.1 ]; then \
		mv debian/tmp/usr/share/man/man1/run.1 \
		  debian/gdb$(TS)/usr/share/man/man1/$(DEB_TARGET_ALIAS)-run.1; \
	fi
ifeq ($(run_tests),yes)
	install -d debian/gdb$(TS)/usr/share/doc/gdb
	install -m 644 $(DEB_BUILDDIR)/gdb/testsuite/gdb.sum \
		debian/gdb$(TS)/usr/share/doc/gdb/check.log
endif

ifneq ($(DEB_CROSS),yes)
	# Only ship a global gdbinit for the native GDB.
	install -d debian/gdb$(TS)/etc/gdb
	install -m 644 debian/gdbinit debian/gdb$(TS)/etc/gdb/
	# Likewise gdb-add-index
	install -m 755 gdb/contrib/gdb-add-index.sh debian/gdb$(TS)/usr/bin/gdb-add-index
endif

	rm -f debian/gdb$(TS)/usr/bin/$(TP)gdbtui
	install -m 755 debian/gdbtui debian/gdb$(TS)/usr/bin/$(TP)gdbtui

binary-post-install/gdb-python2$(TS) ::
	install -d debian/gdb-python24$(TS)/usr/bin
	install -s -m 755 $(BUILDDIRPYTHON2)/gdb/gdb debian/gdb-python2$(TS)/usr/bin/gdb
	if [ -x debian/tmp/usr/bin/run ]; then  \
		install -m 755 debian/tmp/usr/bin/run \
		  debian/gdb-python2$(TS)/usr/bin/$(DEB_TARGET_ALIAS)-run; \
	fi
	if [ -r debian/tmp/usr/share/man/man1/run.1 ]; then  \
		install -m 644 debian/tmp/usr/share/man/man1/run.1			\
		  debian/gdb-python2$(TS)/usr/share/man/man1/$(DEB_TARGET_ALIAS)-run.1;	\
	fi

ifneq ($(DEB_CROSS),yes)
	# Only ship a global gdbinit for the native GDB.
	install -d debian/gdb-python2$(TS)/etc/gdb
	install -m 644 debian/gdbinit debian/gdb-python2$(TS)/etc/gdb/
	# Likewise gdb-add-index
	install -m 755 gdb/contrib/gdb-add-index.sh debian/gdb-python2$(TS)/usr/bin/gdb-add-index
endif

	rm -f debian/gdb-python2$(TS)/usr/bin/$(TP)gdbtui
	install -m 755 debian/gdbtui debian/gdb-python2$(TS)/usr/bin/$(TP)gdbtui

binary-post-install/gdb-multiarch ::
	install -d debian/gdb-multiarch/usr/bin
	install -s -m 755 $(BUILDDIRMULTIARCH)/gdb/gdb debian/gdb-multiarch/usr/bin/gdb-multiarch
	rm -rf debian/gdb-multiarch/usr/share/doc/gdb-multiarch
	ln -s gdb debian/gdb-multiarch/usr/share/doc/gdb-multiarch

binary-post-install/gdbserver ::
	install -d debian/gdbserver/usr/lib
	# This file is only built on some arches (x86 ones, so far)
	-install debian/tmp/usr/lib/libinproctrace.so debian/gdbserver/usr/lib/

binary-post-install/gdb-minimal ::
	install -d debian/gdb-minimal/usr/bin
	$(INSTALL) -m 755 -o root -g root \
		$(BUILDDIRMIN)/gdb/gdb debian/gdb-minimal/usr/bin/gdb

	$(INSTALL) -m 755 -o root -g root \
		$(BUILDDIRMIN)/gdb/gcore debian/gdb-minimal/usr/bin/gcore

	# Only ship a global gdbinit for the native GDB.
	install -d debian/gdb-minimal/etc/gdb
	install -m 644 debian/gdbinit debian/gdb-minimal/etc/gdb/

binary-post-install/gdb-source ::
	install -d debian/gdb-source/usr/src
	mkdir -p $(BUILDDIRSOURCE)
	tar --exclude build --exclude .git -cf - . \
	  | (cd $(BUILDDIRSOURCE) && tar -xf -)
	cd $(BUILDDIRSOURCE) && debian/rules clean
	cd $(dir $(BUILDDIRSOURCE)) \
	  && tar -cjf $(shell pwd)/debian/gdb-source/usr/src/gdb.tar.bz2 \
	     $(notdir $(BUILDDIRSOURCE))

debian/control:: debian/control.in $(CROSS_FORCE)
	cat debian/control.in \
		| sed "s/@TS@/$(TS)/g" \
		> debian/control
ifeq ($(DEB_CROSS),yes)
	sed -i "/Package: gdb-multiarch/,\$$ d" debian/control
	sed "s+/gdb+/$(TP)gdb+g; s+usr/share/$(TP)gdb+usr/share/gdb$(TS)+g" \
		debian/gdb.install > debian/gdb$(TS).install
	sed "s+/gdb+/$(TP)gdb+g; s+usr/share/$(TP)gdb+usr/share/gdb-python2$(TS)+g" \
		debian/gdb.install > debian/gdb-python2$(TS).install
endif

# The default changelog is the top level one, which is useless.
DEB_INSTALL_CHANGELOGS_ALL =

DEB_INSTALL_DOCS_gdb$(TS) = gdb/NEWS gdb/README gdb/doc/refcard.tex \
	$(DEB_BUILDDIR)/gdb/doc/refcard.dvi \
	$(DEB_BUILDDIR)/gdb/doc/refcard.ps \
	debian/README.python_switch \
	gdb/contrib/
DEB_INSTALL_CHANGELOGS_gdb$(TS) = gdb/ChangeLog
ifneq ($(DEB_CROSS),yes)
DEB_INSTALL_MANPAGES_gdb$(TS) = debian/gcore.1
endif

DEB_INSTALL_DOCS_gdb-python2$(TS) = gdb/NEWS gdb/README gdb/doc/refcard.tex \
	$(DEB_BUILDDIR)/gdb/doc/refcard.dvi \
	$(DEB_BUILDDIR)/gdb/doc/refcard.ps \
	debian/README.python_switch \
	gdb/contrib/
DEB_INSTALL_CHANGELOGS_gdb-python2$(TS) = gdb/ChangeLog
ifneq ($(DEB_CROSS),yes)
DEB_INSTALL_MANPAGES_gdb-python2$(TS) = debian/gcore.1
endif

DEB_INSTALL_DOCS_gdbserver = gdb/gdbserver/README
DEB_INSTALL_CHANGELOGS_gdbserver = gdb/gdbserver/ChangeLog

DEB_INSTALL_DOCS_gdb-minimal = $(DEB_INSTALL_DOCS_gdb$(TS))
DEB_INSTALL_CHANGELOGS_gdb-minimal = -XChangeLog

.PHONY: FORCE
FORCE: