~ubuntu-branches/debian/sid/gcc-4.8/sid

78 by Matthias Klose
* GCC 4.8.4 release.
1
#! /usr/bin/make -f
2
# -*- makefile -*-
3
4
# Uncomment this to turn on verbose mode.
5
#export DH_VERBOSE=1
6
7
.SUFFIXES:
8
9
include debian/rules.defs
10
include debian/rules.parameters
11
12
# some tools
13
SHELL	= /bin/bash -e		# brace expansion in rules file
14
IR	= install -m 644	# Install regular file
15
IP	= install -m 755	# Install program
16
IS	= install -m 755	# Install script
17
18
#number of jobs to run for build
19
ifeq ($(USE_NJOBS),no)
20
  NJOBS :=
21
  USE_CPUS := 1
22
else
23
  ifeq ($(with_java),yes)
24
    MEM_PER_CPU = 192
25
  else
26
    MEM_PER_CPU = 128
27
  endif
28
  NUM_CPUS := $(shell if echo $(USE_NJOBS) | grep -q -E '^[0-9]+$$'; \
29
			then echo $(USE_NJOBS); \
30
			else getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1; fi)
31
  USE_CPUS := $(shell mt=`awk '/^MemTotal/ { print $$2 }' /proc/meminfo`; \
32
			awk -vn=$(NUM_CPUS) -vmt=$$mt -vm=$(MEM_PER_CPU) \
33
				'END { mt/=1024; n2 = int(mt/m); print n==1 ? 1 : n2<n+1 ? n2 : n+1}' < /dev/null)
34
  ifneq (,$(strip $(USE_CPUS)))
35
    NJOBS := -j $(USE_CPUS)
36
  endif
37
endif
38
39
# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
40
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
41
  USE_CPUS := $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
42
  NJOBS := -j $(USE_CPUS)
43
endif
44
45
# kernel-specific ulimit hack
46
ifeq ($(findstring linux,$(DEB_HOST_GNU_SYSTEM)),linux)
47
  ULIMIT_M =  if [ -e /proc/meminfo ]; then \
48
	    m=`awk '/^((Mem|Swap)Free|Cached)/{m+=$$2}END{print int(m*.9)}' \
49
		/proc/meminfo`; \
50
	  else \
51
	    m=`vmstat --free --swap-free --kilobytes|awk '{m+=$$2}END{print int(m*.9)}'`; \
52
	  fi; \
53
	  echo "Limiting memory for test runs to $${m}kB"; \
54
	  if ulimit -m $$m; then \
55
	    echo "  limited to `ulimit -m`kB"; \
56
	  else \
57
	    echo "  failed"; \
58
	  fi
59
else
60
  ULIMIT_M = true
61
endif
62
63
ifeq ($(locale_data),generate)
64
  SET_LOCPATH = LOCPATH=$(PWD)/locales
65
endif
66
67
SET_PATH = PATH=$(PWD)/bin:/usr/$(libdir)/gcc/bin:$$PATH
68
ifeq ($(trunk_build),yes)
69
  ifneq (,$(findstring sparc64-linux,$(DEB_TARGET_GNU_TYPE)))
70
    SET_PATH = PATH=/usr/lib/gcc-snapshot/bin:$(PWD)/bin:/usr/$(libdir)/gcc/bin:$$PATH
71
  endif
72
  ifneq (,$(findstring ppc64-linux,$(DEB_TARGET_GNU_TYPE)))
73
    SET_PATH = PATH=/usr/lib/gcc-snapshot/bin:$(PWD)/bin:/usr/$(libdir)/gcc/bin:$$PATH
74
  endif
75
endif
76
77
# the recipient for the test summaries. Send with: debian/rules mail-summary
78
S_EMAIL = gcc@packages.debian.org gcc-testresults@gcc.gnu.org
79
80
# build not yet prepared to take variables from the environment
81
define unsetenv
82
  unexport $(1)
83
  $(1) =
84
endef
85
$(foreach v, CPPFLAGS CFLAGS CXXFLAGS FFLAGS LDFLAGS, $(if $(filter environment,$(origin $(v))),$(eval $(call unsetenv, $(v)))))
86
87
ifeq ($(REVERSE_CROSS),yes)
88
  CC	=
89
else
90
  CC	= $(if $(filter yes,$(with_ada)),gnatgcc,gcc)
91
endif
92
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
93
  CC_FOR_TARGET = $(builddir)/gcc/xgcc -B$(builddir)/gcc/
94
else
95
  CC_FOR_TARGET = $(DEB_TARGET_GNU_TYPE)-gcc
96
endif
97
98
ifneq ($(derivative),Ubuntu)
99
  ifneq (,$(filter $(DEB_TARGET_ARCH), arm armel mips mipsel))
100
    STAGE1_CFLAGS = -g -O2
101
  endif
102
endif
103
104
ifeq ($(with_d),yes)
105
  CFLAGS  += -std=gnu99
106
  LDFLAGS += -lm
107
endif
108
109
# work around PR 57689
110
ifeq ($(DEB_TARGET_ARCH),ia64)
111
  BOOT_CFLAGS	= -g -O1
112
endif
113
114
ifeq ($(with_ssp_default),yes)
115
  STAGE1_CFLAGS	= -g
116
  ifeq (,$(BOOT_CFLAGS))
117
    BOOT_CFLAGS	= -g -O2
118
  endif
119
  LIBCFLAGS		= -g -O2
120
  LIBCXXFLAGS	= -g -O2 -fno-implicit-templates
121
  # Only use -fno-stack-protector when known to the stage1 compiler.
122
  cc-fno-stack-protector := $(shell if $(CC) $(CFLAGS) -fno-stack-protector \
123
                             -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
124
							 then echo "-fno-stack-protector"; fi;)
125
  $(foreach var,STAGE1_CFLAGS BOOT_CFLAGS LIBCFLAGS LIBCXXFLAGS,$(eval \
126
    $(var) += $(cc-fno-stack-protector)))
127
endif
128
129
ifeq ($(DEB_CROSS),yes)
130
  CFLAGS	= -g -O2
131
endif
132
133
ifneq (,$(findstring static,$(DEB_BUILD_OPTIONS)))
134
  LDFLAGS	+= -static
135
endif
136
137
ifneq (,$(filter $(DEB_TARGET_ARCH),alpha))
138
  LDFLAGS += -Wl,--no-relax
139
endif
140
141
CFLAGS_TO_PASS = \
142
	$(if $(CFLAGS),CFLAGS="$(CFLAGS)") \
143
	$(if $(BOOT_CFLAGS),BOOT_CFLAGS="$(BOOT_CFLAGS)") \
144
	$(if $(LIBCFLAGS),LIBCFLAGS="$(LIBCFLAGS)") \
145
	$(if $(LIBCXXFLAGS),LIBCXXFLAGS="$(LIBCXXFLAGS)")
146
LDFLAGS_TO_PASS = \
147
	$(if $(LDFLAGS),LDFLAGS="$(LDFLAGS)")
148
STAGE1_CFLAGS_TO_PASS = \
149
	$(if $(STAGE1_CFLAGS),STAGE1_CFLAGS="$(STAGE1_CFLAGS)")
150
151
docdir		= usr/share/doc
152
153
CONFARGS = -v \
154
	--with-pkgversion='$(distribution)$(if $(with_linaro_branch),/Linaro)___$(DEB_VERSION)' \
155
	--with-bugurl='file:///usr/share/doc/$(subst gcj,gcc,$(PKGSOURCE))/README.Bugs'
156
157
CONFARGS += \
158
	--enable-languages=$(subst $(SPACE),$(COMMA),$(enabled_languages)) \
159
	--prefix=/$(PF)
160
161
ifeq ($(versioned_packages),yes)
162
  CONFARGS += --program-suffix=-$(BASE_VERSION)
163
endif
164
165
ifdef DEB_STAGE
166
  CONFARGS += \
167
	--disable-decimal-float \
168
	--disable-libatomic  \
169
	--disable-libgomp  \
170
	--disable-libmudflap  \
171
	--disable-libssp \
172
	--disable-libquadmath \
173
	--disable-libsanitizer \
174
	--disable-threads \
175
	--libexecdir=/$(libexecdir) \
176
	--libdir=/$(PF)/$(configured_libdir) \
177
	$(if $(with_build_sysroot),--with-build-sysroot=$(with_build_sysroot)) \
178
	$(if $(with_sysroot),--with-sysroot=$(with_sysroot))
179
180
  ifeq ($(with_multiarch_lib),yes)
181
    CONFARGS += \
182
	--enable-multiarch
183
  endif
184
185
  ifeq ($(DEB_STAGE),stage1)
186
    CONFARGS += \
187
	--disable-shared  \
188
	--with-newlib  \
189
	--without-headers
190
  else
191
    # stage2
192
    CONFARGS += \
193
	--enable-shared
194
  endif
195
else
196
  CONFARGS += \
197
	--enable-shared \
198
	--enable-linker-build-id \
199
200
ifneq ($(single_package),yes)
201
  CONFARGS += \
202
        --libexecdir=/$(libexecdir) \
203
        --without-included-gettext \
204
        --enable-threads=posix \
205
	--with-gxx-include-dir=/$(cxx_inc_dir) \
206
	--libdir=/$(PF)/$(configured_libdir)
207
endif
208
209
ifneq ($(with_cpp),yes)
210
  CONFARGS += --disable-cpp
211
endif
212
213
ifeq ($(with_nls),yes)
214
  CONFARGS += --enable-nls
215
else
216
  CONFARGS += --disable-nls
217
endif
218
219
ifeq ($(with_bootstrap),off)
220
  CONFARGS += --disable-bootstrap
221
else ifneq ($(with_bootstrap),)
222
  CONFARGS += --enable-bootstrap=$(with_bootstrap)
223
endif
224
225
ifneq ($(with_sysroot),)
226
  CONFARGS += --with-sysroot=$(with_sysroot)
227
endif
228
ifneq ($(with_build_sysroot),)
229
  CONFARGS += --with-build-sysroot=$(with_build_sysroot)
230
endif
231
232
ifeq ($(force_gnu_locales),yes)
233
  CONFARGS += --enable-clocale=gnu
234
endif
235
236
ifeq ($(with_cxx)-$(with_debug),yes-yes)
237
  CONFARGS += --enable-libstdcxx-debug
238
endif
239
CONFARGS += --enable-libstdcxx-time=yes
240
241
ifeq (,$(filter $(DEB_TARGET_ARCH), hurd-i386 kfreebsd-i386 kfreebsd-amd64))
242
  CONFARGS += --enable-gnu-unique-object
243
endif
244
245
ifneq ($(with_ssp),yes)
246
  CONFARGS += --disable-libssp
247
endif
248
249
CONFARGS += --disable-libmudflap
250
251
ifneq ($(with_gomp),yes)
252
  CONFARGS += --disable-libgomp
253
endif
254
255
ifneq ($(with_itm),yes)
256
  CONFARGS += --disable-libitm
257
endif
258
259
ifneq ($(with_atomic),yes)
260
  CONFARGS += --disable-libatomic
261
endif
262
263
ifneq ($(with_asan),yes)
264
  CONFARGS += --disable-libsanitizer
265
endif
266
267
ifneq ($(with_qmath),yes)
268
  CONFARGS += --disable-libquadmath
269
endif
270
271
ifeq ($(with_plugins),yes)
272
  CONFARGS += --enable-plugin
273
endif
274
275
#ifeq ($(with_gold),yes)
276
#  CONFARGS += --enable-gold --enable-ld=default
277
#endif
278
279
#CONFARGS += --with-plugin-ld=ld.gold
280
#CONFARGS += --with-plugin-ld
281
282
endif # !DEB_STAGE
283
284
CONFARGS += --with-system-zlib
285
286
jvm_name_short = java-1.5.0-gcj-$(BASE_VERSION)$(if $(findstring snap,$(PKGSOURCE)),-snap)
287
jvm_name_long = $(jvm_name_short)-1.5.0.0
288
289
ifeq ($(with_java),yes)
290
  CONFARGS += --disable-browser-plugin
291
  ifeq ($(with_java_maintainer_mode),yes)
292
    CONFARGS += --enable-java-maintainer-mode
293
  endif
294
  ifeq ($(with_java_biarch_awt),yes)
295
    CONFARGS += --enable-java-awt=$(subst $(SPACE),$(COMMA),$(foreach p,$(java_awt_peers),$(p)-default))
296
  else
297
    CONFARGS += --enable-java-awt=$(subst $(SPACE),$(COMMA),$(foreach p,$(java_awt_peers),$(p)))
298
  endif
299
  ifneq (,$(findstring gtk,$(java_awt_peers)))
300
    CONFARGS += --enable-gtk-cairo
301
  endif
302
  jvm_ext = -$(DEB_TARGET_ARCH)$(if $(filter yes,$(DEB_CROSS)),-cross)
303
  jvm_dir = /usr/lib/jvm/$(jvm_name_short)$(jvm_ext)
304
  CONFARGS += --with-java-home=$(jvm_dir)/jre
305
  CONFARGS += --enable-java-home \
306
	--with-jvm-root-dir=$(jvm_dir) \
307
	--with-jvm-jar-dir=/usr/lib/jvm-exports/$(jvm_name_short)$(jvm_ext)
308
  CONFARGS += --with-arch-directory=$(java_cpu)
309
  ifeq (./,$(dir $(ecj_jar)))
310
    CONFARGS += --with-ecj-jar=$(jvm_dir)/lib/ecj.jar
311
  else
312
    CONFARGS += --with-ecj-jar=$(ecj_jar)
313
  endif
314
  ifneq ($(with_libgcj),yes)
315
    CONFARGS += --disable-libgcj
316
  endif
317
endif
318
319
ifeq ($(with_gcj),yes)
320
  ifeq ($(DEB_HOST_GNU_CPU),m32r)
321
    CONFARGS += --enable-libgcj
322
  endif
323
endif
324
325
ifeq ($(with_objc)-$(with_objc_gc),yes-yes)
326
  CONFARGS += --enable-objc-gc
327
endif
328
329
ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), i486-linux-gnu i586-linux-gnu i686-linux-gnu))
330
    ifeq ($(multilib),yes)
331
      ifeq ($(biarch64),yes)
332
        CONFARGS += --enable-targets=all
333
      endif
334
    endif
335
endif
336
337
ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), x86_64-linux-gnu x86_64-linux-gnux32 x86_64-kfreebsd-gnu s390x-linux-gnu sparc64-linux-gnu))
338
    ifneq ($(biarch32),yes)
339
      CONFARGS += --disable-multilib
340
    endif
341
endif
342
343
ifneq (,$(filter $(DEB_TARGET_GNU_TYPE), powerpc-linux-gnu powerpc-linux-gnuspe))
344
    CONFARGS += --enable-secureplt
345
    ifeq ($(biarch64),yes)
346
      CONFARGS += --disable-softfloat --with-cpu=default32
347
      ifeq ($(multilib),yes)
348
        CONFARGS += --disable-softfloat \
349
	  --enable-targets=powerpc-linux,powerpc64-linux
350
      endif
351
    else
352
      CONFARGS += --disable-multilib
353
    endif
354
endif
355
356
ifneq (,$(findstring powerpc64le-linux,$(DEB_TARGET_GNU_TYPE)))
357
    CONFARGS += --enable-secureplt
358
    CONFARGS += --with-cpu=power7 --with-tune=power8
359
    CONFARGS += --disable-multilib
360
endif
361
362
ifneq (,$(findstring powerpc64-linux,$(DEB_TARGET_GNU_TYPE)))
363
    CONFARGS += --enable-secureplt
364
    ifeq ($(biarch32),yes)
365
      ifeq ($(multilib),yes)
366
        CONFARGS += --disable-softfloat --enable-targets=powerpc64-linux,powerpc-linux
367
      endif
368
    else
369
      CONFARGS += --disable-multilib
370
    endif
371
    ifeq ($(derivative),Ubuntu)
372
      CONFARGS += --with-cpu-32=power7 --with-cpu-64=power7
373
    endif
374
endif
375
376
ifeq ($(REVERSE_CROSS),yes)
377
  # FIXME: requires isl and cloog headers for the target
378
  #CONFARGS += --without-isl
379
  # FIXME: build currently fails build the precompiled headers
380
  CONFARGS += --disable-libstdcxx-pch
381
endif
382
383
ifeq ($(with_multiarch_lib),yes)
384
  CONFARGS += --enable-multiarch
385
endif
386
387
ifeq ($(findstring powerpcspe,$(DEB_TARGET_ARCH)),powerpcspe)
388
  CONFARGS += --with-cpu=8548 --enable-e500_double
389
endif
390
391
ifneq (,$(findstring softfloat,$(DEB_TARGET_GNU_CPU)))
392
  CONFARGS += --with-float=soft
393
endif
394
395
ifneq (,$(findstring arm-vfp,$(DEB_TARGET_GNU_CPU)))
396
  CONFARGS += --with-fpu=vfp
397
endif
398
399
ifneq (,$(findstring arm, $(DEB_TARGET_GNU_CPU)))
400
  ifeq ($(multilib),yes)
401
    CONFARGS += --enable-multilib
402
  endif
403
  CONFARGS += --disable-sjlj-exceptions
404
  # FIXME: libjava is not ported for thumb, this hack only works for
405
  # separate gcj builds
406
  ifneq (,$(filter armhf,$(DEB_TARGET_ARCH)))
407
    ifeq ($(distribution),Raspbian)
408
      with_arm_arch = armv6
409
      with_arm_fpu = vfp
410
    else
411
      ifneq (,$(findstring gcj,$(PKGSOURCE)))
412
        with_arm_arch = armv6
413
      else
414
        with_arm_arch = armv7-a
415
      endif
416
      with_arm_fpu = vfpv3-d16
417
    endif
418
  else
419
    # armel
420
    ifeq ($(derivative),Debian)
421
      with_arm_arch = armv4t
422
    else ifneq (,$(filter $(distrelease),karmic))
423
      with_arm_arch = armv6
424
      with_arm_fpu = vfpv3-d16
425
    else ifneq (,$(filter $(distrelease),lucid maverick natty oneiric precise))
426
      ifneq (,$(findstring gcj,$(PKGSOURCE)))
427
        with_arm_arch = armv6
428
      else
429
        with_arm_arch = armv7-a
430
      endif
431
      with_arm_fpu = vfpv3-d16
432
    else
433
      with_arm_arch = armv5t  # starting with quantal
434
    endif
435
  endif
436
  CONFARGS += --with-arch=$(with_arm_arch)
437
  ifneq (,$(with_arm_fpu))
438
    CONFARGS += --with-fpu=$(with_arm_fpu)
439
  endif
440
  CONFARGS += --with-float=$(float_abi)
441
  ifeq ($(with_arm_thumb),yes)
442
    CONFARGS += --with-mode=thumb
443
  endif
444
endif
445
446
ifeq ($(DEB_TARGET_GNU_CPU),$(findstring $(DEB_TARGET_GNU_CPU),m68k))
447
  CONFARGS += --disable-werror
448
endif
449
# FIXME: correct fix-warnings.dpatch
450
ifeq ($(derivative),Ubuntu)
451
  CONFARGS += --disable-werror
452
endif
453
454
ifneq (,$(findstring sparc-linux,$(DEB_TARGET_GNU_TYPE)))
455
  ifeq ($(biarch64),yes)
456
    CONFARGS += --enable-targets=all
457
  endif
458
endif
459
460
ifneq (,$(findstring sparc64-linux,$(DEB_TARGET_GNU_TYPE)))
461
  ifeq ($(biarch32),yes)
462
    CONFARGS += --enable-targets=all
463
  endif
464
endif
465
466
ifneq (,$(findstring ia64-linux,$(DEB_TARGET_GNU_TYPE)))
467
  CONFARGS += --with-system-libunwind
468
endif
469
470
ifneq (,$(findstring sh4-linux,$(DEB_TARGET_GNU_TYPE)))
471
  ifeq ($(multilib),yes)
472
    CONFARGS += --with-multilib-list=m4,m4-nofpu
473
  endif
474
  CONFARGS += --with-cpu=sh4
475
endif
476
477
ifneq (,$(findstring m68k-linux,$(DEB_TARGET_GNU_TYPE)))
478
  CONFARGS += --disable-multilib
479
endif
480
481
ifeq ($(DEB_TARGET_ARCH_OS),linux)
482
  ifneq (,$(findstring $(DEB_TARGET_ARCH), alpha powerpc powerpcspe ppc64 ppc64el s390 s390x sparc sparc64))
483
    CONFARGS += --with-long-double-128
484
  endif
485
endif
486
487
ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 kfreebsd-i386 kfreebsd-amd64))
488
  ifneq (,$(filter $(derivative),Ubuntu))
489
    ifneq (,$(filter $(distrelease),dapper hardy))
490
      CONFARGS += --with-arch-32=i486
491
    else ifneq (,$(filter $(distrelease),jaunty karmic lucid))
492
      CONFARGS += --with-arch-32=i586
493
    else
494
      CONFARGS += --with-arch-32=i686
495
    endif
496
  else # Debian
497
    ifneq (,$(filter $(distrelease),etch lenny))
498
      CONFARGS += --with-arch-32=i486
499
    else
500
      CONFARGS += --with-arch-32=i586
501
    endif
502
  endif
503
endif
504
505
ifeq ($(DEB_TARGET_ARCH),amd64)
506
  CONFARGS += --with-abi=m64
507
endif
508
ifeq ($(DEB_TARGET_ARCH),x32)
509
  CONFARGS += --with-abi=mx32
510
endif
511
ifeq ($(multilib),yes)
512
  ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386))
513
    CONFARGS += --with-multilib-list=m32,m64$(if $(filter yes,$(biarchx32)),$(COMMA)mx32)
514
  else ifeq ($(DEB_TARGET_ARCH),x32)
515
    CONFARGS += --with-multilib-list=mx32,m64,m32
516
  endif
517
endif
518
519
ifneq (,$(filter $(DEB_TARGET_ARCH), hurd-i386))
520
  CONFARGS += --with-arch=i586
521
endif
522
523
ifeq ($(DEB_TARGET_ARCH),lpia)
524
  CONFARGS += --with-arch=pentium-m --with-tune=i586
525
endif
526
527
ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 hurd-i386 kfreebsd-i386 kfreebsd-amd64))
528
  CONFARGS += --with-tune=generic
529
endif
530
531
ifneq (,$(findstring mips-linux,$(DEB_TARGET_GNU_TYPE)))
532
  CONFARGS += --with-arch-32=mips2 --with-tune-32=mips32
533
  ifeq ($(multilib),yes)
534
    ifeq ($(biarchn32)-$(biarch64),yes-yes)
535
      CONFARGS += --enable-targets=all
536
      CONFARGS += --with-arch-64=mips3 --with-tune-64=mips64
537
    endif
538
  endif
539
endif
540
541
ifneq (,$(findstring mipsel-linux,$(DEB_TARGET_GNU_TYPE)))
542
  CONFARGS += --with-arch-32=mips2 --with-tune-32=mips32
543
  ifeq ($(multilib),yes)
544
    ifeq ($(biarchn32)-$(biarch64),yes-yes)
545
      CONFARGS += --enable-targets=all
546
      CONFARGS += --with-arch-64=mips3 --with-tune-64=mips64
547
    endif
548
  endif
549
endif
550
551
#FIXME: howto for mipsn32?
552
ifneq (,$(findstring mips64el-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE)))
553
  CONFARGS += --with-mips-plt
554
  ifeq ($(multilib),yes)
555
    ifeq ($(biarchn32)-$(biarch32),yes-yes)
556
      CONFARGS += --enable-targets=all
557
      CONFARGS += --with-arch-64=mips64r2 --with-tune-64=loongson3a
558
      CONFARGS += --with-arch-32=mips32 --with-tune-32=mips32r2
559
    endif
560
  endif
561
endif
562
563
ifneq (,$(findstring mips64-linux-gnuabin32,$(DEB_TARGET_GNU_TYPE)))
564
  CONFARGS += --with-mips-plt
565
  ifeq ($(multilib),yes)
566
    ifeq ($(biarchn32)-$(biarch32),yes-yes)
567
      CONFARGS += --enable-targets=all
568
      CONFARGS += --with-arch-64=mips64r2 --with-tune-64=octeon+
569
      CONFARGS += --with-arch-32=mips32 --with-tune-32=mips32r2
570
    endif
571
  endif
572
endif
573
574
ifneq (,$(findstring mips64el-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE)))
575
  CONFARGS += --with-mips-plt
576
  CONFARGS += --with-arch-64=mips64r2 --with-tune-64=loongson3a
577
  ifeq ($(multilib),yes)
578
    ifeq ($(biarchn32)-$(biarch32),yes-yes)
579
      CONFARGS += --enable-targets=all
580
      CONFARGS += --with-arch-32=mips2 --with-tune-32=mips32
581
    endif
582
  endif
583
endif
584
585
ifneq (,$(findstring mips64-linux-gnuabi64,$(DEB_TARGET_GNU_TYPE)))
586
  CONFARGS += --with-mips-plt
587
  CONFARGS += --with-arch-64=mips64r2 --with-tune-64=octeon+
588
  ifeq ($(multilib),yes)
589
    ifeq ($(biarchn32)-$(biarch32),yes-yes)
590
      CONFARGS += --enable-targets=all
591
      CONFARGS += --with-arch-32=mips2 --with-tune-32=mips32
592
    endif
593
  endif
594
endif
595
596
ifneq (,$(findstring s390-linux,$(DEB_TARGET_GNU_TYPE)))
597
  ifeq ($(multilib),yes)
598
    ifeq ($(biarch64),yes)
599
      CONFARGS += --enable-targets=all
600
    endif
601
  endif
602
endif
603
604
ifneq (,$(findstring hppa-linux,$(DEB_TARGET_GNU_TYPE)))
605
  CONFARGS += --disable-libstdcxx-pch
606
endif
607
608
ifneq (,$(findstring gdc, $(PKGSOURCE)))
609
    CONFARGS += --disable-libquadmath
610
endif
611
612
ifeq ($(trunk_build),yes)
613
  ifeq ($(findstring --disable-werror, $(CONFARGS)),)
614
    CONFARGS += --disable-werror
615
  endif
616
  CONFARGS += --enable-checking=yes
617
else
618
  CONFARGS += --enable-checking=release
619
endif
620
621
CONFARGS += \
622
	--build=$(DEB_BUILD_GNU_TYPE) \
623
	--host=$(DEB_HOST_GNU_TYPE) \
624
	--target=$(TARGET_ALIAS)
625
626
ifeq ($(DEB_CROSS),yes)
627
  CONFARGS += \
628
	--program-prefix=$(TARGET_ALIAS)-
629
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
630
    CONFARGS += \
631
	--includedir=/$(PFL)/include
632
  endif
633
endif
634
635
ifeq ($(with_bootstrap),off)
636
  bootstrap_target =
637
else ifeq ($(with_bootstrap),)
638
  bootstrap_target = bootstrap-lean
639
  # no profiledbootstrap on the following architectures
640
  # - m68k: we're happy that it builds at all
641
  no_profiled_bs_archs := alpha arm arm64 hppa m68k
642
  ifeq (,$(findstring $(DEB_TARGET_GNU_CPU),$(no_profiled_bs_archs)))
643
    bootstrap_target = profiledbootstrap
644
    # FIXME: disabled for first uploads
645
    bootstrap_target = bootstrap-lean
646
  endif
647
  ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
648
    bootstrap_target = bootstrap-lean
649
  endif
650
  ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
651
    bootstrap_target = bootstrap-lean
652
  endif
653
654
  # disable profiled bootstrap on slow archs, get to testing first ...
655
  ifeq ($(derivative),Debian)
656
    ifneq (,$(filter $(DEB_TARGET_ARCH), arm arm64 armel armhf mips mipsel sparc))
657
      bootstrap_target = bootstrap-lean
658
    endif
659
  endif
660
  ifeq ($(derivative),Ubuntu)
661
    ifneq (,$(filter $(DEB_TARGET_ARCH), arm64 sparc))
662
      bootstrap_target = bootstrap-lean
663
    endif
664
  endif
665
endif
666
667
DEJAGNU_TIMEOUT=300
668
# Increase the timeout for one testrun on slow architectures
669
ifeq ($(derivative),Debian)
670
  ifneq (,$(findstring $(DEB_TARGET_ARCH),arm arm64 armel armhf hppa m68k sparc))
671
    DEJAGNU_TIMEOUT=600
672
  else ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),amd64 i386 i486 i686 lpia))
673
    DEJAGNU_TIMEOUT=180
674
  endif
675
  ifeq ($(DEB_TARGET_GNU_SYSTEM),gnu)
676
    DEJAGNU_TIMEOUT=900
677
  endif
678
else ifeq ($(derivative),Ubuntu)
679
  ifneq (,$(findstring $(DEB_TARGET_ARCH),arm64 armel armhf hppa ia64 sparc))
680
    DEJAGNU_TIMEOUT=600
681
  else ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),amd64 i386 i486 i686 lpia))
682
    DEJAGNU_TIMEOUT=180
683
  endif
684
endif
685
686
DEJAGNU_RUNS =
687
ifneq ($(trunk_build),yes)
688
ifeq ($(with_ssp),yes)
689
  # the buildds are just slow ... don't check the non-default
690
  ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),armel sh4 mips))
691
    DEJAGNU_RUNS =
692
  else
693
    ifneq ($(single_package),yes)
694
      DEJAGNU_RUNS += $(if $(filter yes,$(with_ssp_default)),-fno-stack-protector,-fstack-protector)
695
    endif
696
  endif
697
  # FIXME Ubuntu armel buildd hangs
698
  ifneq (,$(findstring arm, $(DEB_TARGET_GNU_CPU)))
699
    DEJAGNU_RUNS =
700
  endif
701
  ifeq ($(derivative),Ubuntu)
702
    # the buildds are just slow ... don't check the non-default
703
    ifneq (,$(findstring $(DEB_TARGET_GNU_CPU),ia64 sparc))
704
      DEJAGNU_RUNS =
705
    endif
706
  endif
707
endif
708
endif
709
710
ifeq ($(derivative),Ubuntu)
711
  ifneq (,$(findstring arm, $(DEB_TARGET_GNU_CPU)))
712
    ifeq ($(with_arm_thumb),yes)
713
      #DEJAGNU_RUNS += -marm
714
    else
715
      DEJAGNU_RUNS += -mthumb
716
    endif
717
  endif
718
endif
719
720
# no b-d on g++-multilib, this is run by the built compiler
721
abi_run_check = $(strip $(if $(wildcard build/runcheck$(1).out), \
722
				$(shell cat build/runcheck$(1).out), \
723
				$(shell CC="$(builddir)/gcc/xgcc -B$(builddir)/gcc/ -static-libgcc $(1)" bash debian/runcheck.sh)))
724
ifeq ($(biarch32),yes)
725
  DEJAGNU_RUNS += $(call abi_run_check,-m32)
726
endif
727
ifeq ($(biarch64),yes)
728
  DEJAGNU_RUNS += $(call abi_run_check,$(if $(filter $(DEB_TARGET_ARCH_CPU),mips mipsel),-mabi=64,-m64))
729
endif
730
ifeq ($(biarchn32),yes)
731
  DEJAGNU_RUNS += $(call abi_run_check,-mabi=n32)
732
endif
733
ifeq ($(biarchx32),yes)
734
  DEJAGNU_RUNS += $(call abi_run_check,-mx32)
735
endif
736
737
# gdc is not multilib'd
738
ifneq (,$(findstring gdc, $(PKGSOURCE)))
739
  DEJAGNU_RUNS =
740
endif
741
742
ifneq (,$(findstring gcj, $(PKGSOURCE)))
743
  DEJAGNU_RUNS =
744
endif
745
746
# neither is gnat
747
ifneq (,$(findstring gnat, $(PKGSOURCE)))
748
  DEJAGNU_RUNS =
749
endif
750
751
ifneq (,$(strip $(value DEJAGNU_RUNS)))
752
  RUNTESTFLAGS = RUNTESTFLAGS="--target_board=unix\{,$(subst $(SPACE),$(COMMA),$(strip $(DEJAGNU_RUNS)))\}"
753
endif
754
755
# PF is the installation prefix for the package without the leading slash.
756
# It's "usr" for gcc releases.
757
ifneq (,$(PF))
758
  # use value set in the environment
759
else ifeq ($(trunk_build),yes)
760
  PF		= usr/lib/gcc-snapshot
761
else ifeq ($(PKGSOURCE),gcc-linaro)
762
  PF		= usr/lib/gcc-linaro
763
else
764
  PF		= usr
765
endif
766
767
# PFL is the installation prefix with DEB_TARGET_GNU_TYPE attached for cross builds
768
ifeq ($(DEB_CROSS),yes)
769
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
770
    PFL		= $(PF)/$(DEB_TARGET_GNU_TYPE)
771
  else
772
    PFL		= $(PF)
773
  endif
774
else
775
  PFL		= $(PF)
776
endif
777
778
# RPF is the base prefix or installation prefix with DEB_TARGET_GNU_TYPE attached for cross builds
779
ifeq ($(DEB_CROSS),yes)
780
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
781
    RPF		= $(PF)/$(DEB_TARGET_GNU_TYPE)
782
  else
783
    RPF		=
784
  endif
785
else
786
  RPF		=
787
endif
788
789
ifeq ($(with_multiarch_lib),yes)
790
  ifeq ($(DEB_CROSS),yes)
791
    ifneq ($(with_deps_on_target_arch_pkgs),yes)
792
      libdir	= lib
793
    else
794
      libdir	= lib/$(DEB_TARGET_MULTIARCH)
795
    endif
796
  else
797
    libdir	= lib/$(DEB_TARGET_MULTIARCH)
798
  endif
799
else
800
  libdir	= lib
801
endif
802
configured_libdir = lib
803
804
hppa64libexecdir= $(PF)/lib
805
806
# /usr/libexec doesn't follow the FHS
807
ifeq ($(single_package),yes)
808
  libdir	= lib
809
  libexecdir	= $(PF)/libexec
810
  versiondir	= $(GCC_VERSION)
811
else
812
  libexecdir	= $(PF)/$(configured_libdir)
813
  versiondir	= $(BASE_VERSION)
814
endif
815
buildlibdir	= $(builddir)/$(TARGET_ALIAS)
816
817
# install cross compilers in /usr/lib/gcc-cross, native ones in /usr/lib/gcc
818
gcc_subdir_name = gcc
819
ifneq ($(single_package),yes)
820
  ifeq ($(DEB_CROSS),yes)
821
    ifneq ($(with_deps_on_target_arch_pkgs),yes)
822
      gcc_subdir_name = gcc-cross
823
    endif
824
  endif
825
endif
826
827
gcc_lib_dir	= $(PF)/$(configured_libdir)/$(gcc_subdir_name)/$(TARGET_ALIAS)/$(versiondir)
828
gcc_lexec_dir	= $(libexecdir)/$(gcc_subdir_name)/$(TARGET_ALIAS)/$(versiondir)
829
830
lib32loc   = lib32
831
ifneq (,$(findstring mips,$(DEB_TARGET_GNU_TYPE)))
832
lib32loc   = lib
833
endif
834
lib32      = $(PF)/$(lib32loc)
835
lib64		= lib64
836
libn32		= lib32
837
libx32		= libx32
838
839
p_l= $(1)$(cross_lib_arch)
840
p_d= $(1)-dbg$(cross_lib_arch)
841
d_l= debian/$(p_l)
842
d_d= debian/$(p_d)
843
844
ifeq ($(DEB_CROSS),yes)
845
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
846
    usr_lib = $(PFL)/lib
847
848
    # sh4 has multilib. base is sh4-linux-gnu. See #663028.
849
    ifneq (,$(findstring sh4-linux,$(DEB_TARGET_GNU_TYPE)))
850
      usr_lib = $(PFL)/lib/sh4-linux-gnu/
851
    endif
852
  else
853
    usr_lib = $(PFL)/$(libdir)
854
  endif
855
else
856
  usr_lib = $(PFL)/$(libdir)
857
endif
858
usr_lib32 = $(PFL)/$(lib32loc)
859
usr_libn32 = $(PFL)/lib32
860
usr_libx32 = $(PFL)/libx32
861
usr_lib64 = $(PFL)/lib64
862
# FIXME: Move to the new location for native builds too
863
ifeq ($(DEB_CROSS),yes)
864
  usr_libhf = $(PFL)/libhf
865
  usr_libsf = $(PFL)/libsf
866
else
867
  usr_libhf = $(PFL)/lib/arm-linux-gnueabihf
868
  usr_libsf = $(PFL)/lib/arm-linux-gnueabi
869
endif
870
871
gcc_lib_dir32 = $(gcc_lib_dir)/$(biarch32subdir)
872
gcc_lib_dirn32 = $(gcc_lib_dir)/$(biarchn32subdir)
873
gcc_lib_dirx32 = $(gcc_lib_dir)/$(biarchx32subdir)
874
gcc_lib_dir64 = $(gcc_lib_dir)/$(biarch64subdir)
875
gcc_lib_dirhf = $(gcc_lib_dir)/$(biarchhfsubdir)
876
gcc_lib_dirsf = $(gcc_lib_dir)/$(biarchsfsubdir)
877
878
libgcc_dir = $(RPF)/$(libdir)
879
# yes, really; lib32gcc_s ends up in usr
880
libgcc_dir32 = $(PFL)/$(lib32loc)
881
libgcc_dirn32 = $(RPF)/lib32
882
# libx32gcc_s also ends up in usr
883
libgcc_dirx32 = $(PFL)/libx32
884
libgcc_dir64 = $(RPF)/lib64
885
# FIXME: Move to the new location for native builds too
886
ifeq ($(DEB_CROSS),yes)
887
  libgcc_dirhf = $(RPF)/libhf
888
  libgcc_dirsf = $(RPF)/libsf
889
else
890
  libgcc_dirhf = $(RPF)/lib/arm-linux-gnueabihf
891
  libgcc_dirsf = $(RPF)/lib/arm-linux-gnueabi
892
endif
893
894
# install_gcc_lib(lib,soname,flavour,package)
895
define install_gcc_lib
896
	mv $(d)/$(usr_lib$(3))/$(1)*.a debian/$(4)/$(gcc_lib_dir$(3))/
897
	rm -f $(d)/$(usr_lib$(3))/$(1)*.{la,so}
898
	dh_link -p$(4) \
899
	  /$(usr_lib$(3))/$(1).so.$(2) /$(gcc_lib_dir$(3))/$(1).so
900
901
endef
902
903
checkdirs = $(builddir)
904
ifeq ($(with_separate_libgcj),yes)
905
  ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
906
    ifneq ($(with_standalone_gcj),yes)
907
      checkdirs = $(buildlibdir)/libffi $(buildlibdir)/libjava
908
    endif
909
  endif
910
endif
911
ifeq ($(with_separate_go),yes)
912
  ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION))
913
    checkdirs = $(buildlibdir)/libgo
914
  endif
915
endif
916
ifeq ($(with_separate_gnat),yes)
917
  ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
918
    checkdirs = $(builddir)/gcc
919
  endif
920
endif
921
922
ifneq ($(DEB_CROSS),yes)
923
  ifneq ($(single_package),yes)
924
    cxx_inc_dir	= $(PF)/include/c++/$(BASE_VERSION)
925
  else
926
    cxx_inc_dir	= $(PF)/include/c++/$(GCC_VERSION)
927
  endif
928
else
929
  ifeq ($(with_deps_on_target_arch_pkgs),yes)
930
    cxx_inc_dir	= $(PF)/include/c++/$(BASE_VERSION)
931
  else
932
    cxx_inc_dir	= $(PF)/$(TARGET_ALIAS)/include/c++/$(GCC_VERSION)
933
  endif
934
endif
935
936
# FIXME: MULTIARCH_DIRNAME needed for g++-multiarch-incdir.diff
937
MULTIARCH_DIRNAME := $(DEB_TARGET_MULTIARCH)
938
export MULTIARCH_DIRNAME
939
940
default: build
941
942
configure: $(configure_dependencies)
943
944
$(configure_dummy_stamp):
945
	touch $(configure_dummy_stamp)
946
947
$(configure_stamp):
948
	dh_testdir
949
	: # give information about the build process
950
	@echo "------------------------ Build process variables ------------------------"
951
	@echo "Number of parallel processes used for the build: $(USE_CPUS)"
952
	@echo "Package source: $(PKGSOURCE)"
953
	@echo "GCC version: $(GCC_VERSION)"
954
	@echo "Base Debian version: $(BASE_VERSION)"
955
	@echo -e "Configured with: $(subst ___, ,$(foreach i,$(CONFARGS),$(i)\n\t))"
956
ifeq ($(DEB_CROSS),yes)
957
	@echo "Building cross compiler for $(DEB_TARGET_ARCH)"
958
endif
959
	@echo "Using shell $(SHELL)"
960
	@echo "Architecture: $(DEB_TARGET_ARCH) (GNU: $(TARGET_ALIAS))"
961
	@echo "CPPFLAGS: $(CPPFLAGS)"
962
	@echo "CFLAGS: $(CFLAGS)"
963
	@echo "LDFLAGS: $(LDFLAGS)"
964
	@echo "BOOT_CFLAGS: $(BOOT_CFLAGS)"
965
	@echo "DEBIAN_BUILDARCH: $(DEBIAN_BUILDARCH)"
966
	@echo "Install prefix: /$(PF)"
967
ifeq ($(biarchn32)-$(biarch64),yes-yes)
968
	@echo "Will build the triarch compilers (o32/n32/64, defaulting to o32)"
969
else ifeq ($(biarchn32)-$(biarch32),yes-yes)
970
	@echo "Will build the triarch compilers (o32/n32/64, defaulting to 64)"
971
else ifeq ($(biarch64)-$(biarch32),yes-yes)
972
	@echo "Will build the triarch compilers (x32/64/32, defaulting to x32)"
973
else ifeq ($(biarch64)-$(biarchx32),yes-yes)
974
	@echo "Will build the triarch compilers (32/64/x32, defaulting to 32bit)"
975
else ifeq ($(biarch32)-$(biarchx32),yes-yes)
976
	@echo "Will build the triarch compilers (64/32/x32, defaulting to 64bit)"
977
else
978
  ifeq ($(biarch64),yes)
979
	@echo "Will build the biarch compilers (32/64, defaulting to 32bit)"
980
  else
981
    ifeq ($(biarch32),yes)
982
	@echo "Will build the biarch compilers (64/32, defaulting to 64bit)"
983
    else
984
	@echo "Will not build the biarch compilers"
985
    endif
986
  endif
987
endif
988
989
ifeq ($(with_cxx),yes)
990
	@echo "Will build the C++ compiler"
991
else
992
	@echo "Will not build the C++ compiler: $(with_cxx)"
993
endif
994
ifeq ($(with_objc),yes)
995
	@echo "Will build the ObjC compiler."
996
    ifeq ($(with_objc_gc),yes)
997
	@echo "Will build the extra ObjC runtime for garbage collection."
998
    else
999
	@echo "Will not build the extra ObjC runtime for garbage collection."
1000
    endif
1001
else
1002
	@echo "Will not build the ObjC compiler: $(with_objc)"
1003
endif
1004
ifeq ($(with_objcxx),yes)
1005
	@echo "Will build the Obj-C++ compiler"
1006
else
1007
	@echo "Will not build the Obj-C++ compiler: $(with_objcxx)"
1008
endif
1009
ifeq ($(with_fortran),yes)
1010
	@echo "Will build the Fortran 95 compiler."
1011
else
1012
	@echo "Will not build the Fortran 95 compiler: $(with_fortran)"
1013
endif
1014
ifeq ($(with_java),yes)
1015
	@echo "Will build the Java compiler."
1016
else
1017
	@echo "Will not build the Java compiler: $(with_java)"
1018
endif
1019
ifeq ($(with_ada),yes)
1020
	@echo "Will build the Ada compiler."
1021
  ifeq ($(with_libgnat),yes)
1022
	@echo "Will build the shared Ada libraries."
1023
  else
1024
	@echo "Will not build the shared Ada libraries."
1025
  endif
1026
else
1027
	@echo "Will not build the Ada compiler: $(with_ada)"
1028
endif
1029
ifeq ($(with_go),yes)
1030
	@echo "Will build the Go compiler."
1031
else
1032
	@echo "Will not build the Go compiler: $(with_go)"
1033
endif
1034
ifeq ($(with_d),yes)
1035
	@echo "Will build the D compiler"
1036
  ifeq ($(with_libphobos),yes)
1037
	@echo "Will build the phobos D runtime library."
1038
  else
1039
	@echo "Will not build the phobos D runtime library: $(with_libphobos)"
1040
  endif
1041
else
1042
	@echo "Will not build the D compiler: $(with_d)"
1043
endif
1044
ifeq ($(with_ssp),yes)
1045
	@echo "Will build with SSP support."
1046
else
1047
	@echo "Will build without SSP support: $(with_ssp)"
1048
endif
1049
ifeq ($(with_check),yes)
1050
	@echo "Will run the testsuite."
1051
else
1052
	@echo "Will not run the testsuite: $(with_check)"
1053
endif
1054
ifeq ($(with_nls),yes)
1055
	@echo "Will enable national language support."
1056
else
1057
	@echo "Will disable national language support: $(with_nls)"
1058
endif
1059
	@echo "-----------------------------------------------------------------------------"
1060
	@echo ""
1061
ifeq ($(with_check),yes)
1062
	@if echo "spawn true" | /usr/bin/expect -f - >/dev/null; then \
1063
	  : ; \
1064
	else \
1065
	  echo "expect is failing on your system with the above error, which means the GCC"; \
1066
	  echo "testsuite will fail.  Please resolve the above issues and retry the build."; \
1067
	  echo "-----------------------------------------------------------------------------"; \
1068
	  exit 1; \
1069
	fi
1070
endif
1071
	rm -f $(configure_stamp) $(build_stamp)
1072
	cat debian/README.Debian $(patch_stamp) > debian/README.Debian.$(DEB_TARGET_ARCH)
1073
1074
	rm -rf $(builddir)
1075
	mkdir $(builddir)
1076
1077
	: # configure
1078
	cd $(builddir) \
1079
	  && $(SET_PATH) \
1080
		CC="$(CC)" \
1081
		$(SET_SHELL) \
1082
	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada/rts \
1083
		../src/configure $(subst ___, ,$(CONFARGS))
1084
1085
	: # multilib builds without b-d on gcc-multilib (used in FLAGS_FOR_TARGET)
1086
	if [ -d /usr/include/$(DEB_TARGET_MULTIARCH)/asm ]; then \
1087
	  mkdir -p $(builddir)/sys-include; \
1088
	  ln -sf /usr/include/$(DEB_TARGET_MULTIARCH)/asm $(builddir)/sys-include/asm; \
1089
	fi
1090
1091
	touch $(configure_stamp)
1092
1093
build: $(build_dependencies)
1094
1095
$(build_dummy_stamp):
1096
	touch $(build_dummy_stamp)
1097
1098
$(build_locale_stamp):
1099
ifeq ($(locale_data)-$(with_cxx),generate-yes)
1100
	: # build locales needed by libstdc++ testsuite
1101
	rm -rf locales
1102
	mkdir locales
1103
	- sh debian/locale-gen
1104
endif
1105
	touch $(build_locale_stamp)
1106
1107
1108
$(build_stamp): $(configure_stamp) $(build_locale_stamp)
1109
	dh_testdir
1110
	rm -f bootstrap-protocol
1111
# DEB_CROSS is never set if REVERSE_CROSS is set and vice-versa.
1112
# DEB_CROSS build
1113
ifeq ($(DEB_CROSS),yes)
1114
	: # build cross compiler for $(TARGET_ALIAS)
1115
	( \
1116
	  set +e; \
1117
	  $(SET_PATH) \
1118
	  $(SET_LOCPATH) \
1119
	    $(MAKE) -C $(builddir) $(NJOBS) \
1120
		CC="$(CC)" \
1121
		$(CFLAGS_TO_PASS) \
1122
		$(LDFLAGS_TO_PASS) \
1123
		; \
1124
	  echo $$? > status; \
1125
	) 2>&1 | tee bootstrap-protocol
1126
	s=`cat status`; rm -f status; test $$s -eq 0
1127
else
1128
  # REVERSE_CROSS build
1129
  ifeq ($(REVERSE_CROSS),yes)
1130
	: # build cross compiler for $(TARGET_ALIAS)
1131
	( \
1132
	  set +e; \
1133
	  $(SET_PATH) \
1134
	  $(SET_LOCPATH) \
1135
	    $(MAKE) -C $(builddir) $(NJOBS) \
1136
		CC="$(CC)" \
1137
		$(CFLAGS_TO_PASS) \
1138
		$(LDFLAGS_TO_PASS) \
1139
		; \
1140
	  echo $$? > status; \
1141
	) 2>&1 | tee bootstrap-protocol
1142
	s=`cat status`; rm -f status; test $$s -eq 0
1143
else
1144
  # Native build
1145
  ifeq ($(with_java),yes)
1146
	mkdir -p bin
1147
	ln -sf /usr/bin/fastjar bin/jar
1148
    ifeq ($(with_native_ecj),yes)
1149
	: # prepare the standalone ecj jar
1150
	cp /usr/share/java/ecj.jar $(srcdir)/ecj-standalone.jar
1151
	zip -d $(srcdir)/ecj-standalone.jar 'org/eclipse/jdt/core/JDTCompilerAdapter*'
1152
    endif
1153
    ifeq ($(with_java_maintainer_mode),yes)
1154
	( \
1155
	  echo '#!/bin/sh'; \
1156
	  echo 'exec gij-4.8 -cp /usr/share/java/ecj.jar org.eclipse.jdt.internal.compiler.batch.GCCMain "$$@"'; \
1157
	) > bin/ecj1
1158
	chmod +x bin/ecj1
1159
	: # If we don't have gjavah in PATH, try to build it with the old gij
1160
	mkdir -p bin
1161
	if [ -x /usr/bin/gjavah-4.8 ]; then \
1162
	  ln -sf /usr/bin/gjavah-4.8 bin/gjavah; \
1163
	elif [ -x bin/gjavah ]; then \
1164
	  : ; \
1165
	else \
1166
	  mkdir -p $(builddir)/java_hacks; \
1167
	  cd $(builddir)/java_hacks; \
1168
	  cp -a $(srcdir)/libjava/classpath/tools/external external; \
1169
	  mkdir -p gnu/classpath/tools; \
1170
	  cp -a $(srcdir)/libjava/classpath/tools/gnu/classpath/tools/{common,javah,getopt} \
1171
	    gnu/classpath/tools/; \
1172
	  cp -a $(srcdir)/libjava/classpath/tools/resource/gnu/classpath/tools/common/Messages.properties \
1173
	    gnu/classpath/tools/common; \
1174
	  cd external/asm; \
1175
	  for i in `find . -name \*.java`; do gcj-4.8 --encoding ISO-8859-1 -C $$i -I.; done; \
1176
	  cd ../..; \
1177
	  for i in `find gnu -name \*.java`; do gcj-4.8 -C $$i -I. -Iexternal/asm/; done; \
1178
	  gcj-4.8 -findirect-dispatch -O2 -fmain=gnu.classpath.tools.javah.Main \
1179
	    -I. -Iexternal/asm/ `find . -name \*.class` -o $(PWD)/bin/gjavah.real; \
1180
	  ( \
1181
	    echo '#!/bin/sh'; \
1182
	    echo 'export CLASSPATH='`pwd`'$${CLASSPATH:+:$$CLASSPATH}'; \
1183
	    echo 'exec $(PWD)/bin/gjavah.real "$$@"'; \
1184
	  ) > $(PWD)/bin/gjavah; \
1185
	  chmod +x $(PWD)/bin/gjavah; \
1186
	fi
1187
    endif
1188
  endif
1189
	: # build native compiler
1190
	( \
1191
	  set +e; \
1192
	  $(SET_PATH) \
1193
	  $(SET_SHELL) \
1194
	  $(SET_LOCPATH) \
1195
	    $(MAKE) -C $(builddir) $(NJOBS) $(bootstrap_target) \
1196
		CC="$(CC)" \
1197
		$(CFLAGS_TO_PASS) \
1198
		$(STAGE1_CFLAGS_TO_PASS) \
1199
		$(LDFLAGS_TO_PASS) \
1200
		; \
1201
	  echo $$? > status; \
1202
	) 2>&1 | tee bootstrap-protocol
1203
	s=`cat status`; rm -f status; test $$s -eq 0
1204
endif
1205
endif
1206
	-chmod 755 $(srcdir)/contrib/warn_summary
1207
	if [ -x $(srcdir)/contrib/warn_summary ]; then \
1208
	  rm -f bootstrap-summary; \
1209
	  $(srcdir)/contrib/warn_summary bootstrap-protocol \
1210
	    > bootstrap-summary; \
1211
	fi
1212
1213
	touch $(build_stamp)
1214
1215
ifeq ($(versioned_packages),yes)
1216
  hppa64_configure_flags += --program-suffix=-$(BASE_VERSION)
1217
endif
1218
1219
ifeq ($(DEB_CROSS),yes)
1220
  CC_for_hppa64_cross = $(CC)
1221
else
1222
  CC_for_hppa64_cross = $(builddir)/gcc/xgcc -B$(builddir)/gcc/
1223
endif
1224
1225
$(configure_hppa64_stamp): $(build_stamp)
1226
	dh_testdir
1227
	rm -f $(configure_hppa64_stamp) $(build_hppa64_stamp)
1228
	rm -rf $(builddir_hppa64)
1229
	mkdir $(builddir_hppa64)
1230
	: # configure
1231
	cd $(builddir_hppa64) && \
1232
	  $(SET_PATH) \
1233
	  $(SET_SHELL) \
1234
	  CC="$(CC_for_hppa64_cross)" \
1235
	     ../src/configure \
1236
		--enable-languages=c \
1237
		--prefix=/$(PF) \
1238
		--libexecdir=/$(hppa64libexecdir) \
1239
		--disable-shared \
1240
		--disable-nls \
1241
		--disable-threads \
1242
		--disable-libatomic \
1243
		--disable-libgomp \
1244
		--disable-libitm \
1245
		--disable-libmudflap \
1246
		--disable-libssp \
1247
		--disable-libquadmath \
1248
		--enable-plugin \
1249
		--with-system-zlib \
1250
		--with-as=/usr/bin/hppa64-linux-gnu-as \
1251
		--with-ld=/usr/bin/hppa64-linux-gnu-ld \
1252
		--includedir=/usr/hppa64-linux-gnu/include \
1253
		--build=$(DEB_BUILD_GNU_TYPE) \
1254
		--host=$(DEB_HOST_GNU_TYPE) \
1255
		--target=hppa64-linux-gnu
1256
	touch $(configure_hppa64_stamp)
1257
1258
$(build_hppa64_stamp): $(configure_hppa64_stamp)
1259
	  $(SET_PATH) \
1260
	  $(SET_SHELL) \
1261
	  $(SET_LOCPATH) \
1262
	  LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc \
1263
	    $(MAKE) -C $(builddir_hppa64) $(NJOBS) \
1264
		CC="$(CC_for_hppa64_cross)" \
1265
		$(CFLAGS_TO_PASS) \
1266
		$(LDFLAGS_TO_PASS)
1267
	touch $(build_hppa64_stamp)
1268
1269
$(configure_neon_stamp): $(build_stamp)
1270
	dh_testdir
1271
	rm -f $(configure_neon_stamp) $(build_neon_stamp)
1272
	rm -rf $(builddir_neon)
1273
	mkdir $(builddir_neon)
1274
	: # configure
1275
	cd $(builddir_neon) && \
1276
	  $(SET_PATH) \
1277
	  $(SET_SHELL) \
1278
	  CC="$(builddir)/gcc/xgcc -B$(builddir)/gcc/" \
1279
	     ../src/configure \
1280
		--disable-bootstrap \
1281
		--enable-languages=c,c++,objc,fortran \
1282
		--prefix=/$(PF) \
1283
		--libexecdir=/$(libexecdir) \
1284
		--program-suffix=-$(BASE_VERSION) \
1285
		--disable-nls \
1286
		--enable-plugin \
1287
		--disable-libmudflap \
1288
		--with-arch=armv7-a --with-tune=cortex-a8 \
1289
		--with-float=$(float_abi) --with-fpu=neon \
1290
		--host=arm-linux-gnueabi \
1291
		--build=arm-linux-gnueabi \
1292
		--target=arm-linux-gnueabi
1293
	touch $(configure_neon_stamp)
1294
1295
$(build_neon_stamp): $(configure_neon_stamp)
1296
	  $(SET_PATH) \
1297
	  $(SET_SHELL) \
1298
	  $(SET_LOCPATH) \
1299
	    $(MAKE) -C $(builddir_neon) $(NJOBS) \
1300
		CC="$(builddir)/gcc/xgcc -B$(builddir)/gcc/" \
1301
		$(CFLAGS_TO_PASS) \
1302
		$(LDFLAGS_TO_PASS)
1303
	touch $(build_neon_stamp)
1304
1305
1306
MANUALS = \
1307
	$(srcdir)/gcc/doc/cpp.texi \
1308
	$(srcdir)/gcc/doc/cppinternals.texi \
1309
	$(srcdir)/gcc/doc/gcc.texi \
1310
	$(srcdir)/gcc/doc/gccint.texi
1311
ifeq ($(with_fortran),yes)
1312
  MANUALS += $(srcdir)/gcc/fortran/gfortran.texi
1313
endif
1314
ifeq ($(with_java),yes)
1315
  MANUALS += $(srcdir)/gcc/java/gcj.texi
1316
endif
1317
ifeq ($(with_ada),yes)
1318
  MANUALS += \
1319
	$(builddir)/gcc/doc/gnat_ugn.texi \
1320
	$(srcdir)/gcc/ada/gnat_rm.texi \
1321
	$(srcdir)/gcc/ada/gnat-style.texi
1322
endif
1323
ifeq ($(with_gomp),yes)
1324
  MANUALS += $(srcdir)/libgomp/libgomp.texi
1325
endif
1326
ifeq ($(with_itm),yes)
1327
  MANUALS += $(srcdir)/libitm/libitm.texi
1328
endif
1329
ifeq ($(with_qmath),yes)
1330
  MANUALS += $(srcdir)/libquadmath/libquadmath.texi
1331
endif
1332
ifeq ($(with_go),yes)
1333
  MANUALS += $(srcdir)/gcc/go/gccgo.texi
1334
endif
1335
1336
html-docs: $(build_html_stamp)
1337
#$(build_html_stamp): html-texi2html
1338
#$(build_html_stamp): html-makeinfo
1339
$(build_html_stamp): html-makeinfo-nosplit
1340
1341
html-texi2html:
1342
	rm -rf html $(builddir)/gcc/html
1343
	mkdir $(builddir)/gcc/html
1344
	ln -s $(builddir)/gcc/html html
1345
	cd $(builddir)/gcc; \
1346
	for manual in $(MANUALS); do \
1347
	  outname=`basename $${manual} .texi`; \
1348
	  echo "generating $$outname ..."; \
1349
	  texi2html -number -split chapter \
1350
		-I $(srcdir)/gcc/doc/include \
1351
		-I $(srcdir)/gcc/p/doc \
1352
		-I $(srcdir)/gcc/p/doc/generated \
1353
		-I `dirname $${manual}` \
1354
		-I $(builddir)/gcc \
1355
		-I $(buildlibdir)/libquadmath \
1356
		-subdir html \
1357
		$${manual}; \
1358
	done
1359
1360
html-makeinfo:
1361
	rm -rf html
1362
	mkdir html
1363
	cd $(builddir)/gcc; \
1364
	for manual in $(MANUALS); do \
1365
	  manual=`find $(srcdir) -name $${file}.texi`; \
1366
	  outname=`basename $${manual} .texi`; \
1367
	  echo "generating $$outname ..."; \
1368
	  if [ "$${manual}" ]; then \
1369
	    makeinfo --html --number-sections \
1370
		-I $(srcdir)/gcc/doc/include -I `dirname $${manual}` \
1371
		-I $(srcdir)/gcc/p/doc \
1372
		-I $(srcdir)/gcc/p/doc/generated \
1373
		-I $(builddir)/gcc \
1374
		-I $(buildlibdir)/libquadmath \
1375
		-o $${outname} \
1376
		$${manual}; \
1377
	  fi; \
1378
	done
1379
1380
html-makeinfo-nosplit:
1381
	rm -rf html
1382
	mkdir html
1383
	cd $(builddir)/gcc; \
1384
	for manual in $(MANUALS); do \
1385
	  outname=`basename $${manual} .texi`.html; \
1386
	  echo "generating $$outname ..."; \
1387
	  makeinfo --html --number-sections --no-split \
1388
		-I $(srcdir)/gcc/doc/include -I `dirname $${manual}` \
1389
		-I $(srcdir)/gcc/p/doc \
1390
		-I $(srcdir)/gcc/p/doc/generated \
1391
		-I $(builddir)/gcc \
1392
		-I $(buildlibdir)/libquadmath \
1393
		-o $(PWD)/html/$${outname} \
1394
		$${manual}; \
1395
	done
1396
1397
# start the script only on architectures known to have slow autobuilders ...
1398
logwatch_archs := alpha arm m68k mips mipsel sparc
1399
ifeq ($(DEB_HOST_GNU_CPU), $(findstring $(DEB_HOST_GNU_CPU),$(logwatch_archs)))
1400
  start_logwatch = yes
1401
endif
1402
ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
1403
  start_logwatch = yes
1404
endif
1405
1406
stamps/mauve-build: stamps/build
1407
	rm -rf mauve
1408
	mkdir -p mauve
1409
ifeq ($(with_mauve_check),yes)
1410
	tar xf $(wildcard /usr/src/mauve*.tar.*)
1411
	cd mauve \
1412
	    && aclocal \
1413
	    && automake \
1414
	    && autoconf2.59 \
1415
	    && PATH=$(CURDIR)/$(sdkimg)/bin:$$PATH ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE)
1416
	PATH=$(CURDIR)/$(sdkimg)/bin:$$PATH $(MAKE) -C mauve
1417
endif
1418
	touch $@
1419
1420
stamps/mauve-check: stamps/build stamps/mauve-build
1421
ifeq ($(with_mauve_check),yes)
1422
	-cd mauve && \
1423
	    JAVA_HOME=$(CURDIR)/$(sdkimg) \
1424
	    PATH=$(CURDIR)/$(sdkimg)/bin:$$PATH \
1425
		xvfb-run -s "-extension GLX" java Harness \
1426
		    -vm $(CURDIR)/$(sdkimg)/bin/java \
1427
		    -file $(CURDIR)/debian/mauve_tests \
1428
		    -timeout 30000 2>&1 \
1429
		| tee mauve_output
1430
	@sleep 5
1431
else
1432
	echo "mauve testsuite not run for this build" > mauve/mauve_output
1433
endif
1434
	touch $@
1435
1436
check: $(check_stamp) # $(if $(filter yes, $(with_java)),stamps/05-build-mauve-stamp) #$(check_inst_stamp)
1437
$(check_stamp): $(build_stamp) $(build_locale_stamp)
1438
	rm -f test-protocol
1439
	rm -f $(builddir)/runcheck*
1440
1441
	-chmod 755 $(srcdir)/contrib/test_summary
1442
1443
	: # needed for the plugin tests to succeed
1444
	ln -sf gcc $(builddir)/prev-gcc
1445
	ln -sf $(DEB_TARGET_GNU_TYPE) $(builddir)/prev-$(DEB_TARGET_GNU_TYPE)
1446
1447
ifeq (0,1)
1448
ifneq ($(with_common_libs),yes)
1449
  ifeq ($(with_cxx),yes)
1450
	: # libstdc++6 built from newer gcc-4.x source, run testsuite against the installed lib
1451
1452
	sed 's/-L[^ ]*//g' $(buildlibdir)/libstdc++-v3/scripts/testsuite_flags \
1453
	  > $(buildlibdir)/libstdc++-v3/scripts/testsuite_flags.installed
1454
	-$(ULIMIT_M); \
1455
	    set +e; \
1456
	    for d in $(buildlibdir)/libstdc++-v3/testsuite; do \
1457
	      echo "Running testsuite in $$d ..."; \
1458
	      TEST_INSTALLED=1 \
1459
	      $(SET_SHELL) \
1460
	      $(SET_LOCPATH) \
1461
	      $(SET_PATH) \
1462
	      DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
1463
	      DEB_GCC_NO_O3=1 \
1464
		$(MAKE) -k -C $$d $(NJOBS) check $(RUNTESTFLAGS); \
1465
	    done 2>&1 | tee test-protocol2
1466
1467
	BOOT_CFLAGS="$(BOOT_CFLAGS)" \
1468
	  $(srcdir)/contrib/test_summary -m "$(S_EMAIL)" > raw-test-summary
1469
	-( \
1470
	  sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-summary; \
1471
	  awk '/^cat/, /^EOF/' raw-test-summary | grep -v EOF; \
1472
	) > libstdc++-test-summary
1473
	echo 'BEGIN installed libstdc++-v3 test-summary'
1474
	cat libstdc++-test-summary
1475
	echo 'END installed libstdc++-v3 test-summary'
1476
	find $(buildlibdir)/libstdc++-v3/testsuite -name '*.log' -o -name '*.sum' \
1477
	  | xargs -r rm -f
1478
  endif
1479
endif
1480
endif
1481
1482
ifeq ($(start_logwatch),yes)
1483
	: # start logwatch script for regular output during test runs
1484
	chmod +x debian/logwatch.sh
1485
	-debian/logwatch.sh -t 900 -p $(builddir)/logwatch.pid \
1486
		-m '\ntestsuite still running ...\n' \
1487
		test-protocol \
1488
		$(builddir)/gcc/testsuite/gcc/gcc.log \
1489
		$(builddir)/gcc/testsuite/g++/g++.log \
1490
		$(builddir)/gcc/testsuite/gfortran/gfortran.log \
1491
		$(builddir)/gcc/testsuite/objc/objc.log \
1492
		$(builddir)/gcc/testsuite/obj-c++/obj-c++.log \
1493
		$(builddir)/gcc/testsuite/gnat/gnat.log \
1494
		$(builddir)/gcc/testsuite/ada/acats/acats.log \
1495
		$(builddir)/gcc/testsuite/gfortran/gfortran.log \
1496
		$(builddir)/gcc/p/test/test_log \
1497
		$(buildlibdir)/libstdc++-v3/testsuite/libstdc++.log \
1498
		$(buildlibdir)/libjava/testsuite/libjava.log \
1499
		$(buildlibdir)/libmudflap/testsuite/libmudflap.log \
1500
		$(buildlibdir)/libgomp/testsuite/libgomp.log \
1501
		$(buildlibdir)/libffi/testsuite/libffi.log \
1502
		&
1503
endif
1504
1505
ifeq ($(with_ada),yes)
1506
	chmod +x debian/acats-killer.sh
1507
	-debian/acats-killer.sh -p $(builddir)/acats-killer.pid \
1508
		$(builddir)/gcc/testsuite/ada/acats/acats.log \
1509
		$(builddir)/gcc/testsuite/g++.log \
1510
		&
1511
endif
1512
1513
	-$(ULIMIT_M); \
1514
	    set +e; \
1515
	    for d in $(checkdirs); do \
1516
	      echo "Running testsuite in $$d ..."; \
1517
	      $(SET_SHELL) \
1518
	      $(SET_LOCPATH) \
1519
	      $(SET_PATH) \
1520
	      EXTRA_TEST_PFLAGS=-g0 \
1521
	      DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
1522
	      DEB_GCC_NO_O3=1 \
1523
		$(MAKE) -k -C $$d $(NJOBS) check $(RUNTESTFLAGS); \
1524
	    done 2>&1 | tee test-protocol
1525
1526
	-ps aux | fgrep logwatch | fgrep -v fgrep
1527
	-if [ -f $(builddir)/logwatch.pid ]; then \
1528
	  kill -1 `cat $(builddir)/logwatch.pid`; \
1529
	  sleep 1; \
1530
	  kill -9 `cat $(builddir)/logwatch.pid`; \
1531
	  rm -f $(builddir)/logwatch.pid; \
1532
	fi
1533
	-ps aux | fgrep logwatch | fgrep -v fgrep
1534
1535
ifeq ($(with_ada),yes)
1536
	-if [ -f $(builddir)/acats-killer.pid ]; then \
1537
	  kill -1 `cat $(builddir)/acats-killer.pid`; \
1538
	  sleep 1; \
1539
	  kill -9 `cat $(builddir)/acats-killer.pid`; \
1540
	  rm -f $(builddir)/acats-killer.pid; \
1541
	fi
1542
endif
1543
1544
	: # running the libjava testsuite alone is missing this information
1545
	$(builddir)/gcc/xgcc -B$(builddir)/gcc/ -v > $(builddir)/compiler_version.sum 2>&1
1546
1547
	if [ -x $(srcdir)/contrib/test_summary ]; then \
1548
	  rm -f test-summary; \
1549
	  ( \
1550
	    cd $(builddir); \
1551
	    echo '' > ts-include; \
1552
	    echo '' >> ts-include; \
1553
	    if [ -f $(builddir)/gcc/.bad_compare ]; then \
1554
	      echo 'Bootstrap comparison failure:' >> ts-include; \
1555
	      cat $(builddir)/gcc/.bad_compare >> ts-include; \
1556
	      echo '' >> ts-include; \
1557
	      echo '' >> ts-include; \
1558
	    fi; \
1559
	    echo "Build Dependencies:" >> ts-include; \
1560
	    dpkg -l g++-* binutils* `echo '$(LIBC_DEP)' | awk '{print $$1}'` \
1561
		libgmp*-dev libmpfr-dev libmpc-dev libisl-dev libcloog-isl-dev \
1562
	        | fgrep -v '<none>' >> ts-include; \
1563
	    echo '' >> ts-include; \
1564
	    cat ../$(patch_stamp) >> ts-include; \
1565
	    BOOT_CFLAGS="$(BOOT_CFLAGS)" \
1566
	      $(srcdir)/contrib/test_summary \
1567
		-i ts-include -m "$(S_EMAIL)" \
1568
	  ) > raw-test-summary; \
1569
	  if [ -n "$(testsuite_tarball)" ]; then \
1570
	    echo "Test suite used: $(testsuite_srcdir)" > test-summary; \
1571
	    echo "  Do not interpret the results on its own" >> test-summary; \
1572
	    echo "  but compare them with the results from" >> test-summary; \
1573
	    echo "  the gcc-snapshot package." >> test-summary; \
1574
	  fi; \
1575
	  sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-summary \
1576
		>> test-summary; \
1577
	  awk '/^cat/, /^EOF/' raw-test-summary | grep -v EOF >> test-summary; \
1578
	  if [ -f bootstrap-summary -a "$(bootstrap_target)" != profiledbootstrap ]; then \
1579
	    echo '' >> test-summary; \
1580
	    cat bootstrap-summary >> test-summary; \
1581
	  fi; \
1582
	  echo 'BEGIN test-summary'; \
1583
	  cat test-summary; \
1584
	  echo 'END test-summary'; \
1585
	fi
1586
ifeq ($(with_d),yes)
1587
	: # the D test failures for the non-default multilibs are known, ignore them
1588
	egrep -v '^(FAIL|UNRESOLVED): (runnable|fail_c|comp)' test-summary > test-summary.tmp
1589
	mv -f test-summary.tmp test-summary
1590
endif
1591
1592
	touch $(check_stamp)
1593
1594
$(check_inst_stamp): $(check_stamp)
1595
	rm -f test-inst-protocol
1596
1597
ifeq ($(start_logwatch),yes)
1598
	: # start logwatch script for regular output during test runs
1599
	chmod +x debian/logwatch.sh
1600
	-debian/logwatch.sh -t 900 -p $(builddir)/logwatch-inst.pid \
1601
		-m '\ntestsuite (3.3) still running ...\n' \
1602
		test-inst-protocol \
1603
		check-inst/{gcc,g++,g77,objc}.log \
1604
		&
1605
endif
1606
1607
	rm -rf check-inst
1608
	mkdir check-inst
1609
1610
	echo "Running testsuite ..."
1611
	-$(ULIMIT_M) ; \
1612
	    $(SET_SHELL) \
1613
	    $(SET_LOCPATH) \
1614
	    EXTRA_TEST_PFLAGS=-g0 \
1615
	    DEJAGNU_TIMEOUT=$(DEJAGNU_TIMEOUT) \
1616
	  cd check-inst && $(srcdir)/contrib/test_installed \
1617
	    --with-gcc=gcc-3.3 --with-g++=g++-3.3 --with-g77=g77-3.3 \
1618
		2>&1 | tee test-inst-protocol
1619
1620
	-ps aux | fgrep logwatch | fgrep -v fgrep
1621
	if [ -f $(builddir)/logwatch-inst.pid ]; then \
1622
	  kill -1 `cat $(builddir)/logwatch-inst.pid`; \
1623
	else \
1624
	  true; \
1625
	fi
1626
	-ps aux | fgrep logwatch | fgrep -v fgrep
1627
1628
	-chmod 755 $(srcdir)/contrib/test_summary
1629
	if [ -x $(srcdir)/contrib/test_summary ]; then \
1630
	  rm -f test-inst-summary; \
1631
	  ( \
1632
	    cd check-inst; \
1633
	    echo '' > ts-include; \
1634
	    echo '' >> ts-include; \
1635
	    echo "Build Dependencies:" >> ts-include; \
1636
	    dpkg -l g++-* binutils* `echo '$(LIBC_DEP)' | awk '{print $$1}'` \
1637
		libgmp*-dev libmpfr-dev libmpc-dev libisl*-dev libcloog-isl-dev \
1638
	        | fgrep -v '<none>' >> ts-include; \
1639
	    echo '' >> ts-include; \
1640
	    echo 'Results for the installed GCC-3.3 compilers' >> ts-include; \
1641
	    $(srcdir)/contrib/test_summary \
1642
		-i ts-include -m "$(S_EMAIL)" \
1643
	  ) > raw-test-inst-summary; \
1644
	  sed -n '/^Mail/s/.*"\([^"][^"]*\)".*/\1/p' raw-test-inst-summary \
1645
		>> test-inst-summary; \
1646
	  awk '/^cat/, /^EOF/' raw-test-inst-summary \
1647
		| grep -v EOF >> test-inst-summary; \
1648
	  echo 'BEGIN test-installed-summary'; \
1649
	  cat test-inst-summary; \
1650
	  echo 'END test-installed-summary'; \
1651
	fi
1652
1653
	chmod 755 debian/reduce-test-diff.awk
1654
	if diff -u test-inst-summary test-summary \
1655
		| debian/reduce-test-diff.awk > diff-summary; \
1656
	then \
1657
	  mv -f diff-summary testsuite-comparision; \
1658
	else \
1659
	  ( \
1660
	    echo "WARNING: New failures in gcc-3.4 compared to gcc-3.3"; \
1661
	    echo ''; \
1662
	    cat diff-summary; \
1663
	  ) > testsuite-comparision; \
1664
	  rm -f diff-summary; \
1665
	fi
1666
	touch $(check_inst_stamp)
1667
1668
clean: debian/control
1669
	dh_testdir
1670
	rm -f pxxx status
1671
	rm -f *-summary *-protocol testsuite-comparision summary-diff
1672
	if [ -f $(srcdir)/gcc/p/config-lang.in.debian ]; then \
1673
	  mv -f $(srcdir)/gcc/p/config-lang.in.debian $(srcdir)/gcc/p/config-lang.in; \
1674
	else true; fi
1675
	rm -f $(srcdir)/gcc/po/*.gmo
1676
	rm -f debian/lib{gcc,gcj,objc,stdc++}{-v3,[0-9]}*.{{pre,post}{inst,rm},shlibs}
1677
	fs=`echo debian/*BV* debian/*GCJ* debian/*CXX* debian/*LC* debian/*MF* | sort -u`; \
1678
	for f in $$fs; do \
1679
	  [ -f $$f ] || continue; \
1680
	  f2=$$(echo $$f \
1681
		| sed 's/BV/$(BASE_VERSION)/;s/CXX/$(CXX_SONAME)/;s/LGCJ/$(PKG_LIBGCJ_EXT)/;s/GCJ/$(PKG_GCJ_EXT)/;s/LC/$(GCC_SONAME)/;s/-CRB/$(cross_bin_arch)/;s/\.in$$//'); \
1682
	  rm -f $$f2; \
1683
	done
1684
	find debian -maxdepth 1 -name '*.symbols' -type l | xargs -r rm -f
1685
	rm -f debian/gcc-{XX,ar,nm,ranlib}-$(BASE_VERSION).1
1686
	rm -f debian/shlibs.local debian/substvars.local
1687
	rm -f debian/*.debhelper
1688
	-[ -d debian/bugs ] && $(MAKE) -C debian/bugs clean
1689
	rm -f debian/README.libstdc++-baseline debian/README.Bugs debian/README.Debian.$(DEB_TARGET_ARCH)
1690
	rm -f debian/lib*gcj-bc.shlibs
1691
	rm -rf bin locales share
1692
	rm -rf check-inst
1693
	rm -rf .pc
1694
	dh_clean
1695
	$(cross_clean) dh_clean
1696
1697
# -----------------------------------------------------------------------------
1698
# some abbrevations for the package names and directories;
1699
# p_XXX is the package name, d_XXX is the package directory
1700
# these macros are only used in the binary-* targets.
1701
1702
ifeq ($(versioned_packages),yes)
1703
  pkg_ver := -$(BASE_VERSION)
1704
endif
1705
1706
ifneq ($(DEB_CROSS),yes)
1707
  p_base = gcc$(pkg_ver)-base
1708
  p_xbase = gcc$(pkg_ver)-base
1709
  p_gcc  = gcc$(pkg_ver)
1710
  p_cpp  = cpp$(pkg_ver)
1711
  p_cppd = cpp$(pkg_ver)-doc
1712
  p_cxx  = g++$(pkg_ver)
1713
  p_doc  = gcc$(pkg_ver)-doc
1714
  p_lgcc = libgcc$(GCC_SONAME)
1715
else
1716
  # only triggered if DEB_CROSS set
1717
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
1718
    p_base = gcc$(pkg_ver)$(cross_bin_arch)-base
1719
    p_xbase = gcc$(pkg_ver)$(cross_bin_arch)-base
1720
  else
1721
    p_base = gcc$(pkg_ver)-base
1722
    p_xbase = $(p_cpp)
1723
  endif
1724
  p_cpp  = cpp$(pkg_ver)$(cross_bin_arch)
1725
  p_gcc  = gcc$(pkg_ver)$(cross_bin_arch)
1726
  p_cxx  = g++$(pkg_ver)$(cross_bin_arch)
1727
endif
1728
p_hppa64 = gcc$(pkg_ver)-hppa64
1729
1730
d	= debian/tmp
1731
d_base	= debian/$(p_base)
1732
d_xbase = debian/$(p_xbase)
1733
d_gcc	= debian/$(p_gcc)
1734
d_cpp	= debian/$(p_cpp)
1735
d_cppd	= debian/$(p_cppd)
1736
d_cxx	= debian/$(p_cxx)
1737
d_doc	= debian/$(p_doc)
1738
d_lgcc	= debian/$(p_lgcc)
1739
d_hppa64= debian/$(p_hppa64)
1740
1741
d_neon   = debian/tmp-neon
1742
1743
common_substvars = \
1744
	$(shell awk "{printf \"'-V%s' \", \$$0}" debian/substvars.local)
1745
1746
ifeq ($(DEB_CROSS),yes)
1747
  lib_binaries := indep_binaries
1748
else
1749
  lib_binaries := arch_binaries
1750
endif
1751
1752
# ---------------------------------------------------------------------------
1753
1754
ifeq ($(single_package),yes)
1755
  include debian/rules.d/binary-snapshot.mk
1756
else
1757
1758
ifneq ($(DEB_CROSS),yes)
1759
ifeq ($(with_source),yes)
1760
  include debian/rules.d/binary-source.mk
1761
endif
1762
endif
1763
1764
ifneq ($(BACKPORT),true)
1765
ifeq ($(with_gccxbase),yes)
1766
  include debian/rules.d/binary-base.mk
1767
endif
1768
1769
ifeq ($(with_gccbase),yes)
1770
  include debian/rules.d/binary-base.mk
1771
endif
1772
1773
# always include to get some definitions
1774
include debian/rules.d/binary-libgcc.mk
1775
1776
ifeq ($(with_libqmath),yes)
1777
  include debian/rules.d/binary-libquadmath.mk
1778
endif
1779
1780
ifeq ($(with_libgmath),yes)
1781
  include debian/rules.d/binary-libgccmath.mk
1782
endif
1783
1784
ifeq ($(with_libgomp),yes)
1785
  include debian/rules.d/binary-libgomp.mk
1786
endif
1787
1788
ifeq ($(with_libitm),yes)
1789
  include debian/rules.d/binary-libitm.mk
1790
endif
1791
1792
ifeq ($(with_libatomic),yes)
1793
  include debian/rules.d/binary-libatomic.mk
1794
endif
1795
1796
ifeq ($(with_libbacktrace),yes)
1797
  include debian/rules.d/binary-libbacktrace.mk
1798
endif
1799
1800
ifeq ($(with_cdev),yes)
1801
  include debian/rules.d/binary-cpp.mk
1802
endif
1803
1804
ifeq ($(with_fixincl),yes)
1805
  include debian/rules.d/binary-fixincl.mk
1806
endif
1807
1808
ifeq ($(with_libssp),yes)
1809
  include debian/rules.d/binary-libssp.mk
1810
endif
1811
1812
ifeq ($(with_objcxx),yes)
1813
  include debian/rules.d/binary-objcxx.mk
1814
endif
1815
1816
ifeq ($(with_objc),yes)
1817
  include debian/rules.d/binary-objc.mk
1818
  include debian/rules.d/binary-libobjc.mk
1819
endif
1820
1821
ifeq ($(with_go),yes)
1822
  include debian/rules.d/binary-go.mk
1823
endif
1824
1825
# include before cxx
1826
ifeq ($(with_java),yes)
1827
  include debian/rules.d/binary-java.mk
1828
endif
1829
1830
ifeq ($(with_cxxdev),yes)
1831
  include debian/rules.d/binary-cxx.mk
1832
endif
1833
ifeq ($(with_cxx),yes)
1834
  include debian/rules.d/binary-libstdcxx.mk
1835
endif
1836
1837
ifeq ($(with_libasan),yes)
1838
  include debian/rules.d/binary-libasan.mk
1839
endif
1840
1841
ifeq ($(with_libtsan),yes)
1842
  include debian/rules.d/binary-libtsan.mk
1843
endif
1844
1845
ifeq ($(with_f77),yes)
1846
  include debian/rules.d/binary-f77.mk
1847
endif
1848
1849
ifeq ($(with_fortran),yes)
1850
  include debian/rules.d/binary-fortran.mk
1851
endif
1852
1853
ifeq ($(with_ada),yes)
1854
  include debian/rules.d/binary-ada.mk
1855
endif
1856
1857
ifeq ($(with_d),yes)
1858
  include debian/rules.d/binary-d.mk
1859
endif
1860
1861
ifeq ($(with_libnof),yes)
1862
  ifeq ($(DEB_TARGET_GNU_CPU),powerpc)
1863
    include debian/rules.d/binary-nof.mk
1864
  endif
1865
endif
1866
1867
ifeq ($(with_softfloat),yes)
1868
  include debian/rules.d/binary-softfloat.mk
1869
endif
1870
1871
# gcc must be moved/built after g77 and g++
1872
ifeq ($(with_cdev),yes)
1873
  include debian/rules.d/binary-gcc.mk
1874
endif
1875
1876
ifeq ($(with_hppa64),yes)
1877
  include debian/rules.d/binary-hppa64.mk
1878
endif
1879
1880
ifeq ($(with_neon),yes)
1881
  include debian/rules.d/binary-neon.mk
1882
endif
1883
1884
endif
1885
1886
endif # ($(single_package),yes)
1887
1888
# ----------------------------------------------------------------------
1889
install: $(install_dependencies)
1890
1891
$(install_dummy_stamp): $(build_dummy_stamp)
1892
	touch $(install_dummy_stamp)
1893
1894
$(install_snap_stamp): $(build_dependencies)
1895
	dh_testdir
1896
	dh_testroot
1897
	dh_clean -k
1898
1899
	: # Install directories
1900
	rm -rf $(d)
1901
	mkdir -p $(d)/$(PF)
1902
1903
ifeq ($(with_hppa64),yes)
1904
	: # Install hppa64
1905
	$(SET_PATH) \
1906
	    $(MAKE) -C $(builddir_hppa64) \
1907
		CC="$(CC)" \
1908
		$(CFLAGS_TO_PASS) \
1909
		$(LDFLAGS_TO_PASS) \
1910
		DESTDIR=$(PWD)/$(d) \
1911
		    install
1912
1913
	ls -l $(d)/$(PF)/bin
1914
	if [ ! -x $(d)/$(PF)/bin/hppa64-linux-gnu-gcc ]; then \
1915
	  mv $(d)/$(PF)/bin/hppa64-linux-gnu-gcc-4* $(d)/$(PF)/bin/hppa64-linux-gnu-gcc; \
1916
	else \
1917
	  rm -f $(d)/$(PF)/bin/hppa64-linux-gnu-gcc-4*; \
1918
	fi
1919
1920
	for i in ar nm ranlib; do \
1921
	  cp debian/gcc-$$i$(pkg_ver).1 $(d)/$(PF)/share/man/man1/$(cmd_prefix)gcc-$$i$(pkg_ver).1; \
1922
	done
1923
1924
	: # remove files not needed from the hppa64 build
1925
	rm -rf $(d)/$(PF)/share/info
1926
	rm -rf $(d)/$(PF)/share/man
1927
	rm -f $(d)/$(PF)/$(libdir)/libiberty.a
1928
	rm -f $(d)/$(PF)/bin/*{gcov,gccbug,gcc}
1929
1930
	rm -rf $(d)/$(PF)/hppa64-linux-gnu/include
1931
	rm -rf $(d)/$(PF)/hppa64-linux-gnu/lib
1932
	set -e; \
1933
	  cd $(d)/$(PF)/$(libdir)/gcc/hppa64-linux-gnu/$(versiondir)/include-fixed; \
1934
	  for i in *; do \
1935
	    case "$$i" in \
1936
	      README|features.h|syslimits.h|limits.h) ;; \
1937
	      linux|$(TARGET_ALIAS)) ;; \
1938
	      $(subst $(DEB_TARGET_GNU_CPU),$(biarch_cpu),$(TARGET_ALIAS))) ;; \
1939
	      *) echo "remove include-fixed/$$i"; rm -rf $$i; \
1940
	    esac; \
1941
	  done
1942
endif
1943
1944
	: # Work around PR lto/41569
1945
	ln -sf gcc $(builddir)/prev-gcc
1946
	ln -sf $(DEB_TARGET_GNU_TYPE) $(builddir)/prev-$(DEB_TARGET_GNU_TYPE)
1947
1948
	: # Install everything
1949
	$(SET_PATH) \
1950
	$(SET_SHELL) \
1951
	  $(MAKE) -C $(builddir) \
1952
	    $(CFLAGS_TO_PASS) \
1953
	    $(LDFLAGS_TO_PASS) \
1954
	    DESTDIR=$(PWD)/$(d) \
1955
	    infodir=/$(PF)/share/info \
1956
	    mandir=/$(PF)/share/man \
1957
		install
1958
1959
	ls -l $(d)/$(PF)/bin
1960
	if [ ! -x $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc ]; then \
1961
	  mv $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-4* $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc; \
1962
	else \
1963
	  rm -f $(d)/$(PF)/bin/$(TARGET_ALIAS)-gcc-4*; \
1964
	fi
1965
	set -e; \
1966
	  cd $(d)/$(gcc_lib_dir)/include-fixed; \
1967
	  for i in *; do \
1968
	    case "$$i" in \
1969
	      README|features.h|syslimits.h|limits.h) ;; \
1970
	      linux|$(TARGET_ALIAS)) ;; \
1971
	      $(subst $(DEB_TARGET_GNU_CPU),$(biarch_cpu),$(TARGET_ALIAS))) ;; \
1972
	      *) echo "remove include-fixed/$$i"; rm -rf $$i; \
1973
	    esac; \
1974
	  done
1975
1976
ifneq ($(configured_libdir),$(libdir))
1977
	for i in debug go pkgconfig '*.so' '*.so.*' '*.a' '*.la' '*.py' '*.spec'; do \
1978
	  mv $(d)/$(PF)/$(configured_libdir)/$$i \
1979
		$(d)/$(PF)/$(libdir)/. || true; \
1980
	  mv $(d)/$(PF)/libo32/$$i \
1981
	    $(d)/$(PF)/lib/. || true; \
1982
	done
1983
endif
1984
1985
# FIXME: libjava/classpath not correctly patched
1986
ifeq ($(with_java),yes)
1987
	-if [ -d $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME) ]; then \
1988
	  ls -l $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME); \
1989
	  mv $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME)/* \
1990
	    $(d)/$(PF)/lib/gcj-$(BASE_VERSION)-$(GCJ_SONAME)/; \
1991
	  rmdir $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME); \
1992
	fi
1993
1994
	ln -sf libgcj.so.$(GCJ_SONAME).0.0 $(d)/$(PF)/lib/libgcj_bc.so.1.0.0
1995
1996
	install -m 755 $(d)/$(PF)/lib/libgcj_bc.so.1 \
1997
		$(d)/$(gcc_lib_dir)/libgcj_bc.so
1998
	$(builddir)/gcc/xgcc -B$(builddir)/gcc/ -shared -fpic -xc /dev/null \
1999
		-o build/libgcj.so -Wl,-soname,libgcj.so.$(GCJ_SONAME) -nostdlib
2000
	$(builddir)/gcc/xgcc -B$(builddir)/gcc/ -shared -fpic \
2001
		$(srcdir)/libjava/libgcj_bc.c \
2002
		-o $(d)/$(gcc_lib_dir)/libgcj_bc.so \
2003
		-Wl,-soname,libgcj_bc.so.1 $(builddir)/libgcj.so -shared-libgcc
2004
endif
2005
2006
	-ls -l $(d)/usr
2007
	if [ -d $(d)/usr/man/man1 ]; then \
2008
	  mv $(d)/usr/man/man1/* $(d)/usr/share/man/man1/; \
2009
	fi
2010
2011
	chmod 755 debian/dh_*
2012
	touch $(install_snap_stamp)
2013
2014
$(install_stamp): $(build_stamp)
2015
	dh_testdir
2016
	dh_testroot
2017
	dh_clean -k -N$(p_hppa64)
2018
2019
	if [ -f $(binary_stamp)-hppa64 ]; then \
2020
	  mv $(binary_stamp)-hppa64 saved-stamp-hppa64; \
2021
	fi
2022
	rm -f $(binary_stamp)*
2023
	if [ -f saved-stamp-hppa64 ]; then \
2024
	  mv saved-stamp-hppa64 $(binary_stamp)-hppa64; \
2025
	fi
2026
2027
	: # Install directories
2028
	rm -rf $(d)
2029
	mkdir -p $(d)/$(libdir) $(d)/$(PF) $(d)/$(PF)/$(libdir)/debug
2030
ifeq ($(biarch32),yes)
2031
	mkdir -p $(d)/$(PF)/$(lib32loc)/debug
2032
endif
2033
ifeq ($(biarch64),yes)
2034
	mkdir -p $(d)/$(PF)/lib64/debug
2035
endif
2036
ifeq ($(biarchn32),yes)
2037
	mkdir -p $(d)/$(PF)/$(libn32)/debug
2038
endif
2039
ifeq ($(biarchx32),yes)
2040
	mkdir -p $(d)/$(PF)/libx32/debug
2041
endif
2042
2043
ifneq (,$(filter $(DEB_TARGET_GNU_CPU),x86_64 sparc64 s390x powerpc64))
2044
ifneq ($(DEB_TARGET_ARCH),x32)
2045
	: # link lib to lib64 and $(PF)/lib to $(PF)/lib64
2046
	: # (this works when CONFARGS contains '--disable-multilib')
2047
	ln -s $(configured_libdir) $(d)/lib64
2048
	mkdir -p $(d)/$(PF)/$(configured_libdir)
2049
	ln -s $(configured_libdir) $(d)/$(PF)/lib64
2050
endif
2051
endif
2052
ifeq ($(DEB_TARGET_ARCH),x32)
2053
	: # link lib to libx32 and $(PF)/lib to $(PF)/libx32
2054
	ln -s $(configured_libdir) $(d)/libx32
2055
	mkdir -p $(d)/$(PF)/$(configured_libdir)
2056
	ln -s $(configured_libdir) $(d)/$(PF)/libx32
2057
endif
2058
2059
	: # Work around PR lto/41569
2060
	ln -sf gcc $(builddir)/prev-gcc
2061
2062
	: # Install everything
2063
	$(SET_PATH) \
2064
	$(SET_SHELL) \
2065
	  $(MAKE) -C $(builddir) \
2066
	    $(CFLAGS_TO_PASS) \
2067
	    $(LDFLAGS_TO_PASS) \
2068
	    DESTDIR=$(PWD)/$(d) \
2069
	    infodir=/$(PF)/share/info \
2070
	    mandir=/$(PF)/share/man \
2071
		install
2072
2073
ifneq ($(configured_libdir),$(libdir))
2074
	for i in debug go pkgconfig '*.so' '*.so.*' '*.a' '*.la' '*.o' '*.py' '*.spec'; do \
2075
	  mv $(d)/$(PF)/$(configured_libdir)/$$i \
2076
		$(d)/$(PF)/$(libdir)/. || true; \
2077
	  mv $(d)/$(PF)/libo32/$$i \
2078
	    $(d)/$(PF)/lib/. || true; \
2079
	done
2080
endif
2081
2082
ifeq ($(with_libcxxdbg),yes)
2083
	: # FIXME: the libstdc++ gdb.py file is installed with a wrong name
2084
	for i in $$(find $(d)/$(PF) -name libstdc++_pic.a-gdb.py); do \
2085
	  [ -f $$i ] || continue; \
2086
	  d=$$(dirname $$i); \
2087
	  b=$$(basename $$i); \
2088
	  t=$$(cd $$d; echo libstdc++.so.*.*.*)-gdb.py; \
2089
	  mv $$i $$d/$$t; \
2090
	done
2091
endif
2092
2093
# FIXME: libjava/classpath not correctly patched
2094
ifeq ($(with_java),yes)
2095
	-if [ -d $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME) ]; then \
2096
	  ls -l $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME); \
2097
	  mv $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME)/* \
2098
	    $(d)/$(PF)/lib/gcj-$(BASE_VERSION)-$(GCJ_SONAME)/; \
2099
	  rmdir $(d)/$(PF)/lib/gcj-$(GCC_VERSION)-$(GCJ_SONAME); \
2100
	fi
2101
endif
2102
2103
	: # remove rpath settings from binaries and shared libs
2104
	for i in $$(chrpath -k $(d)/$(PF)/bin/* $(d)/$(PF)/lib*/lib*.so.* \
2105
			$(if $(filter $(with_multiarch_lib),yes), \
2106
			  $(d)/$(PF)/lib/$(DEB_HOST_MULTIARCH)/lib*.so.*) \
2107
			$(d)/$(PF)/lib*/gcj$(pkg_ver)*/lib*.so.* \
2108
			2>/dev/null | awk -F: '/RPATH=/ {print $$1}'); \
2109
	do \
2110
	  case "$$i" in ecj1|*gij-*|*libjawt*|*libjvm*) continue; esac; \
2111
	  [ -h $$i ] && continue; \
2112
	  chrpath --delete $$i; \
2113
	  echo "removed RPATH: $$i"; \
2114
	done
2115
2116
	: # remove '*.la' and '*.lai' files, not shipped in any package.
2117
	find $(d) -name '*.la' -o -name '*.lai' | xargs -r rm -f
2118
2119
ifneq ($(with_libgnat),yes)
2120
	rm -f $(d)/$(gcc_lib_dir)/adalib/lib*.so*
2121
endif
2122
2123
ifeq ($(GFDL_INVARIANT_FREE),yes)
2124
	for i in gcc gcov; do \
2125
	  I=`echo $$i | tr a-z A-Z`; \
2126
	  sed -e "s/@NAME@/$$I$(pkg_ver)/g" -e "s/@name@/$$i$(pkg_ver)/g" \
2127
	    debian/dummy-man.1 > $(d)/$(PF)/share/man/man1/$$i.1; \
2128
	done
2129
2130
  ifeq ($(with_fortran),yes)
2131
	for i in g77; do \
2132
	  I=`echo $$i | tr a-z A-Z`; \
2133
	  sed -e "s/@NAME@/$$I$(pkg_ver)/g" -e "s/@name@/$$i$(pkg_ver)/g" \
2134
	    debian/dummy-man.1 > $(d)/$(PF)/share/man/man1/$$i.1; \
2135
	done
2136
  endif
2137
  ifeq ($(with_java),yes)
2138
	for i in gcj gcjh gij jv-convert jv-scan jcf-dump grmic grmiregistry; \
2139
	do \
2140
	  I=`echo $$i | tr a-z A-Z`; \
2141
	  sed -e "s/@NAME@/$$I$(pkg_ver)/g" -e "s/@name@/$$i$(pkg_ver)/g" \
2142
	    debian/dummy-man.1 > $(d)/$(PF)/share/man/man1/$$i.1; \
2143
	done
2144
  endif
2145
endif
2146
2147
#  ifeq ($(with_ada),yes)
2148
#	: # rename files (versioned ada binaries)
2149
#	for i in ; do \
2150
#	  mv $(d)/$(PF)/bin/$$i $(d)/$(PF)/bin/$$i-$(GNAT_VERSION); \
2151
#	  mv $(d)/$(PF)/share/man/man1/$$i.1 \
2152
#		$(d)/$(PF)/share/man/man1/$$i-$(GNAT_VERSION).1; \
2153
#	done
2154
#	for i in $(GNAT_TOOLS); do \
2155
#	  mv $(d)/$(PF)/bin/$$i $(d)/$(PF)/bin/$$i-$(GNAT_VERSION); \
2156
#	done
2157
#  endif
2158
2159
ifeq ($(DEB_CROSS)-$(multilib),yes-yes)
2160
  ifneq ($(DEB_STAGE),stage1)
2161
    ifeq ($(DEB_TARGET_ARCH)-$(biarch64),s390-yes)
2162
	: # s390 64bit stuff happens to be in s390x-linux-gnu/lib64/
2163
	mkdir -p $(d)/$(PF)/s390-linux-gnu/lib64
2164
	cp -a $(d)/$(PF)/s390x-linux-gnu/lib64/* $(d)/$(PF)/s390-linux-gnu/lib64/
2165
    endif
2166
    ifeq ($(DEB_TARGET_ARCH)-$(biarch64),powerpc-yes)
2167
	: # ppc 64bit build slaps libgcc and libstdc++ to powerpc64-linux-gnu
2168
	mkdir -p $(d)/$(PF)/powerpc-linux-gnu/lib64
2169
	cp -a $(d)/$(PF)/powerpc64-linux-gnu/lib64/* $(d)/$(PF)/powerpc-linux-gnu/lib64/
2170
    endif
2171
  endif
2172
endif
2173
2174
	for i in ar nm ranlib; do \
2175
	  cp debian/gcc-$$i$(pkg_ver).1 $(d)/$(PF)/share/man/man1/$(cmd_prefix)gcc-$$i$(pkg_ver).1; \
2176
	done
2177
2178
	chmod 755 debian/dh_*
2179
2180
#	tar cf tmp.tar debian/tmp
2181
2182
	touch $(install_stamp)
2183
2184
$(install_hppa64_stamp): $(build_hppa64_stamp)
2185
	dh_testdir
2186
	dh_testroot
2187
	rm -rf $(d_hppa64)
2188
	mkdir -p $(d_hppa64)/$(PF)
2189
2190
	$(SET_PATH) \
2191
	    $(MAKE) -C $(builddir_hppa64) \
2192
		CC="$(CC)" \
2193
		$(CFLAGS_TO_PASS) \
2194
		$(LDFLAGS_TO_PASS) \
2195
		DESTDIR=$(PWD)/$(d_hppa64) \
2196
		    install
2197
2198
ifeq ($(versioned_packages),yes)
2199
	for i in cpp gcc-ar gcc-nm gcc-ranlib; do \
2200
	  mv -f $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i \
2201
		$(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i$(pkg_ver); \
2202
	done
2203
endif
2204
2205
ifneq ($(single_package),yes)
2206
	: # remove files not needed
2207
	rm -rf $(d_hppa64)/$(PF)/info $(d_hppa64)/$(PF)/share/info
2208
	rm -rf $(d_hppa64)/$(PF)/man $(d_hppa64)/$(PF)/share/man
2209
	rm -rf $(d_hppa64)/$(PF)/$(libdir)/gcc/hppa64-linux-gnu/$(GCC_VERSION)/plugin
2210
	rm -f $(d_hppa64)/$(PF)/$(libdir)/libiberty.a
2211
	rm -f $(d_hppa64)/$(PF)/bin/*{gcov,gccbug,gcc}
2212
2213
	rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu/include
2214
	rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu/lib
2215
	rm -rf $(d_hppa64)/$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(GCC_VERSION)/install-tools
2216
endif
2217
2218
	touch $(install_hppa64_stamp)
2219
2220
$(install_neon_stamp): $(build_neon_stamp)
2221
	dh_testdir
2222
	dh_testroot
2223
	rm -rf $(d_neon)
2224
	mkdir -p $(d_neon)/$(PF)
2225
2226
	$(SET_PATH) \
2227
	    $(MAKE) -C $(builddir_neon) \
2228
		CC="$(CC)" \
2229
		$(CFLAGS_TO_PASS) \
2230
		$(LDFLAGS_TO_PASS) \
2231
		DESTDIR=$(PWD)/$(d_neon) \
2232
		    install
2233
	touch $(install_neon_stamp)
2234
2235
# ----------------------------------------------------------------------
2236
# Build architecture-dependent files here.
2237
#binary-arch: build install $(foreach i,$(arch_binaries),$(binary_stamp)-$(i))
2238
binary-arch: $(foreach i,$(arch_binaries),$(binary_stamp)-$(i))
2239
ifeq ($(with_check),yes)
2240
	@echo Done
2241
#	: # Send Email about sucessfull build.
2242
#	# cat raw-test-summary | sh; echo "Sent mail to $(S_EMAIL)"
2243
endif
2244
2245
# ----------------------------------------------------------------------
2246
# Build architecture-independent files here.
2247
#binary-indep: build install $(foreach i,$(indep_binaries),$(binary_stamp)-$(i))
2248
binary-indep: $(foreach i,$(indep_binaries),$(binary_stamp)-$(i))
2249
2250
source diff:
2251
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
2252
2253
binary: binary-indep binary-arch
2254
.PHONY: build clean binary-indep binary-arch binary