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

« back to all changes in this revision

Viewing changes to .svn/pristine/cd/cdb137f3fbc1438de31ba54e8c964a97196afa14.svn-base

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-12-19 19:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20141219194834-4dz1q7rrn5pad823
Tags: 4.8.4-1
* GCC 4.8.4 release.
  - Fix PR target/61407 (darwin), PR middle-end/58624 (ice),
    PR sanitizer/64265 (wrong code).
* Require recent binutils to pass go test failures.

Show diffs side-by-side

added added

removed removed

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