2
# definitions used in more than one Makefile / rules file
5
SHELL = /bin/bash -e # brace expansion used in rules file
8
builddir = $(PWD)/build
11
distribution := $(shell lsb_release -is)
12
distrelease := $(shell lsb_release -cs)
14
# On non official archives, "lsb_release -cs" default to "n/a". Assume
16
ifeq ($(distrelease),n/a)
20
on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd ] && echo yes)
22
# creates {srcdir,builddir}_{hppa64,neon,spu}
23
$(foreach x,srcdir builddir,$(foreach target,hppa64 spu neon,$(eval \
24
$(x)_$(target) := $($(x))-$(target))))
26
# for architecture dependent variables and changelog vars
27
vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
31
DPKG_VARS := $(shell dpkg-architecture)
32
DEB_BUILD_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE)
33
DEB_HOST_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
34
DEB_HOST_GNU_CPU ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU)
35
DEB_HOST_GNU_SYSTEM ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_SYSTEM)
36
DEB_HOST_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)
37
DEB_HOST_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
39
CHANGELOG_VARS := $(shell dpkg-parsechangelog | \
40
sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p')
42
# the name of the source package
43
PKGSOURCE := $(call vafilt,$(CHANGELOG_VARS),Source)
44
# those are required here too
45
SOURCE_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version)
46
DEB_VERSION := $(strip $(shell echo $(SOURCE_VERSION) | \
47
sed -e 's/.*://' -e 's/ds[0-9]*//'))
48
# epoch used for gcc versions up to 3.3.x, now used for some remaining
49
# libraries: libgcc1, libobjc1
51
DEB_EVERSION := $(EPOCH):$(DEB_VERSION)
52
BASE_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')
54
ifneq (,$(findstring gdc,$(PKGSOURCE)))
55
BASE_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/.*-\([1-9]\.[0-9]\).*-.*/\1/')
58
# push glibc stack traces into stderr
59
export LIBC_FATAL_STDERR_=1
61
# ---------------------------------------------------------------------------
63
# - GNU triplet via DEB_TARGET_GNU_TYPE
64
# - Debian arch in debian/target
65
# - Debian arch via DEB_GCC_TARGET or GCC_TARGET
69
DEB_GCC_TARGET := $(GCC_TARGET)
71
ifdef DEB_TARGET_GNU_TYPE
72
TARGET_VARS := $(shell dpkg-architecture -f -t$(DEB_TARGET_GNU_TYPE) 2>/dev/null)
74
# allow debian/target to be used instead of DEB_GCC_TARGET - this was requested
75
# by toolchain-source maintainer
76
DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell cat debian/target 2>/dev/null)))
77
ifndef DEB_TARGET_ARCH
78
ifneq (,$(DEBIAN_TARGET_FILE))
79
DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
82
DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
84
DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
88
TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
91
DEB_TARGET_ARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
92
DEB_TARGET_ARCH_OS ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
93
DEB_TARGET_ARCH_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
94
DEB_TARGET_GNU_CPU ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
95
DEB_TARGET_GNU_TYPE ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
96
DEB_TARGET_GNU_SYSTEM ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
97
DEB_TARGET_MULTIARCH ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_MULTIARCH)
99
ifeq ($(DEB_TARGET_ARCH),)
100
$(error Invalid architecure.)
103
# including unversiond symlinks for binaries
104
#with_unversioned = yes
106
# ---------------------------------------------------------------------------
107
# cross-compiler config
108
# - typical cross-compiler
109
# - reverse cross (built to run on the target)
113
# build != host && host == target : reverse cross (REVERSE_CROSS == yes)
114
# build == host && host != target : typical cross (DEB_CROSS == yes)
115
# build != host && host != target : canadian (DEB_CROSS == yes)
116
# build == host && host == target : native
117
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
118
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
124
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
127
# first ones are squeeze+1 and maverick
128
ifeq (,$(filter $(distrelease),lenny etch squeeze sid dapper hardy jaunty karmic lucid))
134
# ---------------------------------------------------------------------------
135
# cross compiler support
136
ifeq ($(DEB_CROSS),yes)
137
# TARGET: Alias to DEB_TARGET_ARCH (Debian arch name)
138
# TP: Target Prefix. Used primarily as a prefix for cross tool
139
# names (e.g. powerpc-linux-gcc).
140
# TS: Target Suffix. Used primarily at the end of cross compiler
141
# package names (e.g. gcc-powerpc).
142
# LS: Library Suffix. Used primarily at the end of cross compiler
143
# library package names (e.g. libgcc-powerpc-cross).
144
DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
145
TARGET := $(DEB_TARGET_ARCH)
146
TP := $(subst _,-,$(DEB_TARGET_GNU_TYPE))-
147
TS := -$(subst _,-,$(DEB_TARGET_ALIAS))
148
LS := -$(subst _,-,$(DEB_TARGET_ARCH))-cross
150
cross_bin_arch := -$(subst _,-,$(DEB_TARGET_ALIAS))
151
cross_lib_arch := -$(subst _,-,$(DEB_TARGET_ARCH))-cross
152
cmd_prefix := $(DEB_TARGET_GNU_TYPE)-
154
TARGET_ALIAS := $(DEB_TARGET_ALIAS)
156
lib_binaries := indep_binaries
157
cross_shlibdeps = $(SET_CROSS_LIB_PATH) ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something"
159
TARGET_ALIAS := $(DEB_TARGET_GNU_TYPE)
161
ifeq ($(TARGET_ALIAS),i386-gnu)
162
TARGET_ALIAS := i586-gnu
167
#ifeq ($(TARGET_ALIAS),i486-linux-gnu)
168
# TARGET_ALIAS := i686-linux-gnu
171
TARGET_ALIAS := $(subst i386,i486,$(TARGET_ALIAS))
173
# configure as linux-gnu, not linux
174
#ifeq ($(findstring linux,$(TARGET_ALIAS))/$(findstring linux-gnu,$(TARGET_ALIAS)),linux/)
175
# TARGET_ALIAS := $(TARGET_ALIAS)-gnu
178
# configure as linux, not linux-gnu
179
#TARGET_ALIAS := $(subst linux-gnu,linux,$(TARGET_ALIAS))
181
lib_binaries := arch_binaries
186
@echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH)
187
@echo DEB_TARGET_ARCH_OS: $(DEB_TARGET_ARCH_OS)
188
@echo DEB_TARGET_ARCH_CPU: $(DEB_TARGET_ARCH_CPU)
189
@echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM)
190
@echo DEB_TARGET_MULTIARCH: $(DEB_TARGET_MULTIARCH)
191
@echo MULTIARCH_CONFARG: $(MULTIARCH_CONFARG)
192
@echo TARGET_ALIAS: $(TARGET_ALIAS)
196
# -------------------------------------------------------------------
199
# "yes" is the default and causes a 3-stage bootstrap.
200
# "off" runs a complete build with --disable-bootstrap
201
# "no" means to just build the first stage, and not create the stage1
203
# "lean" means a lean 3-stage bootstrap, i.e. delete each stage when no
205
with_bootstrap = $(WITH_BOOTSTRAP)
207
ifneq ($(findstring nostrap, $(DEB_BUILD_OPTIONS)),)
208
with_bootstrap := off
211
# -------------------------------------------------------------------
216
# "stage1" is minimal compiler with static libgcc
217
# "stage2" is minimal compiler with shared libgcc
218
ifeq ($(DEB_STAGE),stage1)
219
with_shared_libgcc := no
221
ifeq ($(DEB_STAGE),stage2)
223
with_shared_libgcc := yes
227
ifeq ($(BACKPORT),true)
230
with_base_only := yes
233
# -------------------------------------------------------------------
236
with_sysroot = $(WITH_SYSROOT)
238
ifdef WITH_BUILD_SYSROOT
239
with_build_sysroot = $(WITH_BUILD_SYSROOT)
242
# -------------------------------------------------------------------
243
# for components configuration
246
SPACE = $(EMPTY) $(EMPTY)
248
# lang= overwrites all of nolang=, overwrites all of WITHOUT_LANG
250
DEB_LANG_OPT := $(filter lang=%,$(DEB_BUILD_OPTIONS))
251
DEB_LANG := $(strip $(subst $(COMMA), ,$(patsubst lang=%,%,$(DEB_LANG_OPT))))
252
DEB_NOLANG_OPT := $(filter nolang=%,$(DEB_BUILD_OPTIONS))
253
DEB_NOLANG := $(strip $(subst $(COMMA), ,$(patsubst nolang=%,%,$(DEB_NOLANG_OPT))))
254
lfilt = $(strip $(if $(DEB_LANG), \
255
$(if $(filter $(1) $(2),$(DEB_LANG)),yes),$(3)))
256
nlfilt = $(strip $(if $(DEB_NOLANG), \
257
$(if $(filter $(1) $(2),$(DEB_NOLANG)),disabled by $(DEB_NOLANG_OPT),$(3))))
258
wlfilt = $(strip $(if $(filter $(1) $(2), $(subst $(COMMA), ,$(WITHOUT_LANG))), \
259
disabled by WITHOUT_LANG=$(WITHOUT_LANG),$(3)))
260
envfilt = $(strip $(or $(call lfilt,$(1),$(2)),$(call nlfilt,$(1),$(3)),$(call wlfilt,$(1),$(3)),$(4)))
262
# -------------------------------------------------------------------
263
# architecture specific config
265
# FIXME: libjava is not ported for thumb, this hack only works for
266
# separate gcj builds
267
ifeq (,$(findstring gcj,$(PKGSOURCE)))
268
ifeq ($(distribution),Ubuntu)
269
with_arm_thumb := yes
271
ifeq ($(DEB_TARGET_ARCH),armhf)
272
with_arm_thumb := yes
276
# build using fsf or linaro
277
ifeq ($(distribution),Ubuntu)
278
ifeq (,$(findstring gnat, $(PKGSOURCE)))
279
ifneq (,$(findstring $(DEB_TARGET_ARCH),armel armhf amd64 i386 powerpc))
280
with_linaro_branch = yes
285
# check if we're building for armel or armhf
286
ifeq ($(DEB_TARGET_ARCH),armhf)
288
else ifneq (,$(filter $(distribution)-$(DEB_TARGET_ARCH), Ubuntu-armel))
290
else ifneq (,$(filter $(DEB_TARGET_ARCH), arm armel))
294
# -------------------------------------------------------------------
297
# common things ---------------
298
# build common packages, where package names don't differ in different
299
# gcc versions (fixincludes, libgcj-common) ...
300
with_common_pkgs := yes
301
# ... and some libraries, which do not change (libgcc1, libmudflap, libssp0).
302
with_common_libs := yes
303
# XXX: should with_common_libs be "yes" only if this is the default compiler
304
# version on the targeted arch?
306
# is this a multiarch-enabled build?
307
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick))
308
with_multiarch_lib := yes
311
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick))
312
multiarch_stage1 := yes
315
# mapping for the non-default biarch multilib / multiarch names
316
multiarch_xarch_map = \
317
amd64=i386-linux-gnu \
318
armel=arm-linux-gnueabi \
319
armhf=arm-linux-gnueabihf \
320
i386=x86_64-linux-gnu \
321
powerpc=powerpc64-linux-gnu \
322
ppc64=powerpc-linux-gnu \
323
sparc=sparc64-linux-gnu \
324
sparc64=sparc-linux-gnu \
325
s390=s390x-linux-gnu \
326
s390x=s390-linux-gnu \
327
mips=mips64-linux-gnuabin32,mips64-linux-gnuabi64 \
328
mipsel=mips64el-linux-gnuabin32,mips64el-linux-gnuabi64 \
329
kfreebsd-amd64=i386-kfreebsd-gnu
330
xarch_multiarch_names = $(subst $(COMMA),$(SPACE),$(patsubst $(DEB_TARGET_ARCH)=%,%, \
331
$(filter $(DEB_TARGET_ARCH)=%,$(multiarch_xarch_map))))
333
ifneq ($(DEB_STAGE),stage1)
334
# build a -base package.
335
ifneq ($(DEB_CROSS),yes)
342
# build dev packages.
347
# set lang when built from a different source package.
350
ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE)))
353
else ifneq (,$(findstring gcc-linaro, $(PKGSOURCE)))
357
# --program-suffix=-$(BASE_VERSION)
358
versioned_packages := yes
361
#no_dummy_cpus := ia64 i386 hppa s390 sparc
362
#ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(no_dummy_cpus)))
363
# with_base_only := no
364
# with_common_libs := yes
365
# with_common_pkgs := yes
367
# with_base_only := yes
368
# with_common_libs := no
369
# with_common_pkgs := no
373
ifeq ($(versioned_packages),yes)
374
pkg_ver := -$(BASE_VERSION)
378
# -------------------------------------------------------------------
379
# configure languages
381
# C ---------------------------
382
enabled_languages := c
384
# Build all packages needed for C development
385
ifneq ($(with_base_only),yes)
386
ifeq ($(with_dev),yes)
392
# Ada --------------------
393
ada_no_cpus := m32r m68k sh3 sh3eb sh4 sh4eb
394
ada_no_systems := gnu knetbsd-gnu
397
ifneq (,$(filter $(DEB_TARGET_ARCH),armhf m68k powerpcspe sh4 sparc64))
401
ifeq ($(with_dev),yes)
402
ifneq ($(separate_lang),yes)
406
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(ada_no_cpus)))
407
with_ada := disabled for cpu $(DEB_TARGET_ARCH_CPU)
409
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
410
with_ada := disabled for system $(DEB_TARGET_GNU_SYSTEM)
412
ifeq ($(ada_no_cross)-$(DEB_CROSS),yes-yes)
413
with_ada := disabled for cross compiler package
415
ifeq ($(ada_no_snap)-$(single_package),yes-yes)
416
with_ada := disabled for snapshot build
418
with_ada := $(call envfilt, ada, , , $(with_ada))
420
ifneq ($(single_package),yes)
421
with_separate_gnat := yes
423
ifeq ($(with_ada)-$(with_separate_gnat),yes-yes)
424
ifneq (,$(findstring gnat,$(PKGSOURCE)))
428
debian_extra_langs += ada
429
with_ada := built from separate source
430
with_libgnat := built from separate source
434
ifeq ($(with_ada),yes)
435
enabled_languages += ada
437
# There are two exception handling mechanisms: ZCX (Zero-Cost
438
# eXceptions) and SJLJ (setjump/longjump), selected and supported by
439
# libgnat. Thus we build both versions of libgnat on architectures
440
# that support both (see ada-sjlj.diff). Most cpus support both
441
# mechanisms; here, we declare the few that support only one.
442
libgnat_zcx_only_cpus :=
443
libgnat_sjlj_only_cpus := arm armel armhf
444
ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(libgnat_sjlj_only_cpus)))
449
ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(libgnat_zcx_only_cpus)))
452
with_gnat_sjlj := yes
454
ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),no-no)
455
# TODO: support cpus that do not support exceptions at all,
456
# perhaps by building a restricted runtime library? For now, flag
457
# this as a packaging error.
458
$(error this target supports neither ZCX nor SJLJ)
462
# C++ -------------------------
464
ifneq ($(with_base_only),yes)
465
ifneq ($(separate_lang),yes)
469
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(cxx_no_cpus)))
470
with_cxx := disabled for cpu $(DEB_TARGET_ARCH_CPU)
472
with_cxx := $(call envfilt, c++, obj-c++ java, , $(with_cxx))
474
# Build all packages needed for C++ development
475
ifeq ($(with_cxx),yes)
476
ifeq ($(with_dev),yes)
478
with_libcxxdbg := yes
480
ifeq ($(with_common_pkgs),yes)
484
# debugging versions of libstdc++
485
ifeq ($(with_cxxdev),yes)
488
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(debug_no_cpus)))
489
with_debug := disabled for cpu $(DEB_TARGET_GNU_CPU)
492
with_debug := $(call envfilt, debug, , , $(with_debug))
494
enabled_languages += c++
497
# Java --------------------
498
# - To build a standalone gcj package (with no corresponding gcc
499
# package): with_separate_libgcj=yes, with_standalone_gcj=yes
500
# - To build the java packages from the gcc source package:
501
# with_separate_libgcj=no, with_standalone_gcj=no
502
# - To build gcc and java from separate sources:
503
# with_separate_libgcj=yes, with_standalone_gcj=no
505
java_no_cpus := # mips mipsel
506
java_no_systems := knetbsd-gnu
509
ifneq ($(single_package),yes)
510
with_separate_libgcj := yes
512
with_standalone_gcj := no
514
ifneq ($(separate_lang),yes)
518
# java converted for V3 C++ ABI for some archs
519
ifeq ($(with_base_only),yes)
522
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(java_no_cpus)))
523
with_java := disabled for cpu $(DEB_TARGET_ARCH_CPU)
525
ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
526
with_java := disabled for system $(DEB_TARGET_GNU_SYSTEM)
528
ifeq ($(java_no_cross)-$(DEB_CROSS),yes-yes)
529
with_java := diasbled for cross compiler package
531
with_java := $(call envfilt, java, , c++, $(with_java))
533
ifeq ($(with_java)-$(with_separate_libgcj),yes-yes)
534
ifneq (,$(findstring gcj, $(PKGSOURCE)))
538
debian_extra_langs += java
539
with_java := built from separate source
540
with_gcj := built from separate source
541
with_libgcj := buit from separate source
545
with_java_plugin := no
547
ifeq ($(with_java),yes)
548
# use the same names as OpenJDK
549
java_cpu_map = armel=arm armhf=arm hppa=parisc i686=i386 i586=i386 i486=i386 mipsel=mips powerpc=ppc sh4=sh
550
java_cpu = $(patsubst $(DEB_TARGET_ARCH_CPU)=%,%, \
551
$(filter $(DEB_TARGET_ARCH_CPU)=%,$(java_cpu_map)))
553
java_cpu = $(DEB_TARGET_ARCH_CPU)
555
java_priority = 10$(subst .,,$(BASE_VERSION))
560
ifneq (,$(findstring gcj-4,$(PKGSOURCE)))
561
ifneq (,$(filter $(DEB_TARGET_ARCH), arm))
562
with_gcj_base_only := yes
566
ifeq ($(single_package),yes)
570
#ifneq (,$(filter $(DEB_TARGET_ARCH),hppa))
571
# with_native_ecj := yes
574
with_java_maintainer_mode := no
576
# used as well in debian/rules.conf to determine the build deps
577
java_awt_peers = gtk # qt # xlib
579
ifeq ($(with_common_libs),yes)
580
with_libgcj_doc := yes
583
# Build all packages needed for Java development (gcj, libgcj-dev)
584
ifeq ($(with_dev),yes)
589
with_java_alsa := yes
590
ifeq (,$(filter $(DEB_TARGET_GNU_SYSTEM),linux-gnu))
594
enabled_languages += java
597
# D ---------------------------
601
ifneq ($(single_package),yes)
602
with_separate_gdc := yes
605
ifneq ($(separate_lang),yes)
608
ifeq ($(d_no_snap)-$(single_package),yes-yes)
609
with_d := disabled for snapshot build
612
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
613
ifneq (,$(findstring gdc,$(PKGSOURCE)))
617
debian_extra_langs += d
618
with_d := built from separate source
622
ifeq ($(with_base_only),yes)
627
# no suffix for D 1.0
628
#libphobos_version :=
630
libphobos_version := 2
632
with_libphobos := yes
634
libphobos_no_cpus := alpha avr arm hppa ia64 m68k mips mipsel powerpc ppc64 s390 sh4 sparc sparc64
635
libphobos_no_systems := gnu
636
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(libphobos_no_cpus)))
637
with_libphobos := disabled for cpu $(DEB_TARGET_ARCH_CPU)
639
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libphobos_no_systems)))
640
with_libphobos := disabled for system $(DEB_TARGET_GNU_SYSTEM)
643
enabled_languages += d
646
# Fortran 95 -------------------
647
fortran_no_cross := yes
648
fortran_no_cross := no
650
ifneq ($(with_base_only),yes)
651
ifneq ($(separate_lang),yes)
655
ifeq ($(fortran_no_cross)-$(DEB_CROSS),yes-yes)
656
with_fortran := diasbled for cross compiler package
658
with_fortran := $(call envfilt, fortran, , , $(with_fortran))
660
# Build all packages needed for Fortran development
661
ifeq ($(with_fortran),yes)
662
ifeq ($(with_dev),yes)
665
ifeq ($(with_common_libs),yes)
666
with_libgfortran := yes
668
enabled_languages += fortran
671
# libquadmath -------------------
673
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU), ia64 i386 i486 i586 i686 amd64))
675
ifneq (,$(findstring gcc-4,$(PKGSOURCE)))
676
ifeq ($(with_common_libs),yes)
682
# ObjC ------------------------
685
ifneq ($(with_base_only),yes)
686
ifneq ($(separate_lang),yes)
690
ifeq ($(objc_no_cross)-$(DEB_CROSS),yes-yes)
691
with_objc := diasbled for cross compiler package
693
with_objc := $(call envfilt, objc, obj-c++, , $(with_objc))
695
ifeq ($(with_objc),yes)
696
# the ObjC runtime with garbage collection enabled needs the Boehm GC
699
# disable ObjC garbage collection library (needs libgc)
700
libgc_no_cpus := avr mips mipsel # alpha amd64 arm armel armhf hppa i386 ia64 m68k mips mipsel powerpc ppc64 s390 s390x sparc
701
libgc_no_systems := knetbsd-gnu
702
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(libgc_no_cpus)))
703
with_objc_gc := disabled for cpu $(DEB_TARGET_ARCH_CPU)
705
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
706
with_objc_gc := disabled for system $(DEB_TARGET_GNU_SYSTEM)
709
# Build all packages needed for Objective-C development
710
ifeq ($(with_dev),yes)
713
# libobjc soname change in 4.7
714
#ifeq ($(with_common_libs),yes)
718
enabled_languages += objc
721
# ObjC++ ----------------------
722
objcxx_no_cross := no
724
ifneq ($(with_base_only),yes)
725
ifneq ($(separate_lang),yes)
729
ifeq ($(objcxx_no_cross)-$(DEB_CROSS),yes-yes)
730
with_objcxx := diasbled for cross compiler package
732
with_objcxx := $(call envfilt, obj-c++, , c++ objc, $(with_objcxx))
734
ifeq ($(with_objcxx),yes)
735
enabled_languages += obj-c++
738
# Go -------------------
742
go_no_cpus := avr arm hppa ia64 m68k mips mipsel powerpc ppc64 s390 s390x sh4 sparc sparc64
743
ifneq ($(trunk_build),yes)
744
go_no_cpus := := $(go_no_cpus) alpha
746
go_no_systems := gnu kfreebsd-gnu
748
ifneq ($(with_base_only),yes)
749
ifneq ($(separate_lang),yes)
753
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(go_no_cpus)))
754
with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU)
756
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(go_no_systems)))
757
with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM)
759
ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes)
760
with_go := diasbled for cross compiler package
762
with_go := $(call envfilt, go, , , $(with_go))
764
# Build all packages needed for Go development
765
ifeq ($(with_go),yes)
766
ifeq ($(with_common_libs),yes)
769
enabled_languages += go
772
# -------------------------------------------------------------------
775
# not built from the main source package
776
ifeq (,$(findstring gcc,$(PKGSOURCE)))
781
ifeq ($(trunk_build),yes)
784
with_nls := $(call envfilt, nls, , , $(with_nls))
786
# powerpc nof libraries -----
789
ifneq (,$(findstring gcc-4,$(PKGSOURCE)))
792
with_source := $(call envfilt, source, , , $(with_source))
794
# ssp & libssp -------------------------
796
ssp_no_archs = alpha hppa ia64 m68k
797
ifneq (, $(filter $(DEB_TARGET_ARCH),$(ssp_no_archs) $(ssp_no_archs:%=uclibc-%)))
798
with_ssp := not available on $(DEB_TARGET_ARCH)
800
with_ssp := $(call envfilt, ssp, , , $(with_ssp))
802
ifeq ($(with_ssp),yes)
803
ifneq ($(distribution),Debian)
804
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
805
with_ssp_default := yes
810
# mudflap -------------------
812
with_mudflap := $(call envfilt, mudflap, , , $(with_mudflap))
814
# gomp --------------------
816
with_gomp := $(call envfilt, gomp, , , $(with_gomp))
818
# itm --------------------
819
itm_archs = amd64 i386
820
ifneq (,$(filter $(DEB_TARGET_ARCH),$(itm_archs)))
823
with_itm := $(call envfilt, itm, , , $(with_itm))
825
# gold --------------------
826
# armel with binutils 2.20.51 only
827
gold_archs = amd64 armel armhf i386 lpia powerpc ppc64 sparc
828
ifneq (,$(filter $(DEB_TARGET_ARCH),$(gold_archs)))
832
# plugins --------------------
835
endif # ifndef DEB_STAGE
837
# Don't include docs with GFDL invariant sections
838
GFDL_INVARIANT_FREE := yes
839
ifeq ($(distribution),Ubuntu)
840
GFDL_INVARIANT_FREE := no
842
GFDL_INVARIANT_FREE := no
844
# -------------------------------------------------------------------
846
ifeq ($(extra_package),yes)
847
ifeq ($(with_separate_libgcj)-$(with_standalone_gcj),yes-no)
858
# libssp ------------------
859
ifeq ($(with_ssp)-$(with_common_libs),yes-yes)
860
#ifneq ($(DEB_CROSS),yes)
861
with_libssp := $(if $(wildcard $(builddir)/gcc/auto-host.h), \
862
$(shell if grep -qs '^\#define TARGET_LIBC_PROVIDES_SSP 1' $(builddir)/gcc/auto-host.h; then echo 'libc provides ssp'; else echo 'yes'; fi))
866
# libmudflap --------------
867
ifeq ($(with_mudflap)-$(with_common_libs),yes-yes)
868
with_libmudflap := yes
871
# libgomp -----------------
872
ifeq ($(with_gomp)-$(with_common_libs),yes-yes)
873
#ifneq ($(DEB_CROSS),yes)
878
# libitm -----------------
879
ifeq ($(with_itm)-$(with_common_libs),yes-yes)
880
#ifneq ($(DEB_CROSS),yes)
885
# libquadmath -----------------
886
ifeq ($(with_qmath)-$(with_common_libs),yes-yes)
887
#ifneq ($(DEB_CROSS),yes)
892
# fixincludes -------
893
ifneq ($(DEB_CROSS),yes)
894
ifeq ($(with_common_pkgs),yes)
899
# Shared libgcc --------------------
900
ifeq ($(with_common_libs),yes)
902
ifneq ($(DEB_STAGE),stage1)
903
with_shared_libgcc := yes
907
# libgcc-math --------------------
909
ifneq (,$(findstring i486,$(DEB_TARGET_ARCH)))
910
#with_libgccmath := yes
911
#with_lib64gmath := yes
912
#with_libgmathdev := yes
914
ifeq ($(DEB_TARGET_ARCH),amd64)
915
#with_libgccmath := yes
916
#with_lib32gmath := yes
917
#with_libgmathdev := yes
920
# hppa64 build ----------------
922
ifeq ($(DEB_TARGET_ARCH),hppa)
925
ifeq ($(hppa64_no_snap)-$(trunk_build),yes-yes)
926
with_hppa64 := disabled for snapshot build
928
with_hppa64 := $(call envfilt, hppa64, , , $(with_hppa64))
930
# spu build -------------------
932
# FTBFS on ppc64, PR 48495
933
ifneq (,$(findstring $(DEB_TARGET_ARCH),powerpc))
934
ifneq ($(DEB_CROSS),yes)
938
ifeq ($(spu_no_snap)-$(trunk_build),yes-yes)
939
with_spu := disabled for snapshot build
941
with_spu := $(call envfilt, spu, , , $(with_spu))
943
ifeq ($(with_spu),yes)
948
# neon build -------------------
949
# FIXME: build as a cross compiler to build on armv4 as well
950
ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
951
ifeq ($(distribution),Ubuntu)
952
# neon_archs = armel armhf
953
# ifneq (, $(filter $(DEB_TARGET_ARCH),$(neon_archs)))
960
# run testsuite ---------------
962
# if you don't want to run the gcc testsuite, uncomment the next line
963
#with_check := disabled by hand
964
ifeq ($(with_base_only),yes)
967
ifeq ($(DEB_CROSS),yes)
968
with_check := disabled for cross compiler package
970
ifeq ($(REVERSE_CROSS),yes)
971
with_check := disabled for reverse cross build
973
check_no_cpus := m68k
974
check_no_systems := gnu
975
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(check_no_cpus)))
976
with_check := disabled for cpu $(DEB_TARGET_ARCH_CPU)
978
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
979
with_check := disabled for system $(DEB_TARGET_GNU_SYSTEM)
981
ifeq ($(distribution)-$(DEB_HOST_ARCH),Ubuntu-hppa)
982
ifneq ($(single_package),yes)
983
with_check := disabled, testsuite timeouts with expect
986
ifneq (,$(findstring gdc,$(PKGSOURCE)))
987
with_check := disabled for D
989
with_check := $(call envfilt, check, , , $(with_check))
991
with_check := disabled by environment
993
ifneq ($(findstring nocheck, $(DEB_BUILD_OPTIONS)),)
994
with_check := disabled by DEB_BUILD_OPTIONS
996
#with_check := disabled for this build
998
# not a dependency on all archs, but if available, use it for the testsuite
999
ifneq (,$(wildcard /usr/bin/localedef))
1000
locale_data = generate
1003
all_enabled_languages := $(enabled_languages)
1004
languages_without_lang_opt := c++ objc obj-c++
1006
debian_extra_langs := $(subst obj-c++,objcp,$(debian_extra_langs))
1007
export debian_extra_langs
1010
biarch_map := i686=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x s390x=s390 \
1011
x86_64=i686 powerpc64=powerpc mips=mips64 mipsel=mips64el
1012
ifeq (,$(filter $(distrelease),lenny etch squeeze sid dapper hardy jaunty karmic lucid))
1013
biarch_map := $(subst i686=,i486=,$(biarch_map))
1015
ifeq ($(distribution),Ubuntu)
1016
ifeq (,$(filter $(distrelease),dapper hardy jaunty karmic lucid maverick natty))
1017
biarch_map += arm=arm
1020
biarch_cpu := $(strip $(patsubst $(DEB_TARGET_GNU_CPU)=%,%, \
1021
$(filter $(DEB_TARGET_GNU_CPU)=%,$(biarch_map))))
1030
ifneq (yes,$$(call envfilt, biarch, , ,yes))
1033
ifneq (,$$(findstring /$$(DEB_TARGET_ARCH)/,$$(biarch$1archs)))
1036
#biarch$1subdir = $$(biarch_cpu)-$$(DEB_TARGET_GNU_SYSTEM)
1038
ifeq ($$(with_libgcc),yes)
1039
with_lib$1gcc := yes
1041
ifeq ($$(with_libcxx),yes)
1042
with_lib$1cxx := yes
1044
ifeq ($$(with_libcxxdbg),yes)
1045
with_lib$1cxxdbg := yes
1047
ifeq ($$(with_libobjc),yes)
1048
with_lib$1objc := yes
1050
ifeq ($$(with_libgfortran),yes)
1051
with_lib$1gfortran := yes
1053
ifeq ($$(with_libmudflap),yes)
1054
with_lib$1mudflap := yes
1056
ifeq ($$(with_libssp),yes)
1057
with_lib$1ssp := yes
1059
ifeq ($$(with_libgomp),yes)
1060
with_lib$1gomp:= yes
1062
ifeq ($$(with_libitm),yes)
1065
ifeq ($$(with_libqmath),yes)
1066
with_lib$1qmath := yes
1068
ifeq ($$(with_libgo),yes)
1072
biarch_multidir_names = libiberty libgcc
1073
ifneq (,$$(findstring gcc-, $$(PKGSOURCE)))
1074
biarch_multidir_names += libstdc++-v3 libobjc libgfortran libssp \
1075
libgomp libmudflap zlib libitm
1076
ifeq ($$(with_objc_gc),yes)
1077
biarch_multidir_names += boehm-gc
1080
ifneq (,$(findstring yes, $(with_java) $(with_go)))
1081
biarch_multidir_names += libffi
1083
ifeq ($(with_fortran),yes)
1084
biarch_multidir_names += libquadmath
1086
ifeq ($(with_go),yes)
1087
biarch_multidir_names += libgo
1089
export biarch_multidir_names
1090
ifneq (,$$(findstring 32,$1))
1091
TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \
1093
TARGET32_MACHINE := $$(TARGET_ALIAS)
1095
TARGET64_MACHINE := $$(TARGET_ALIAS)
1096
TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \
1099
export TARGET32_MACHINE
1100
export TARGET64_MACHINE
1103
biarch32archs := /amd64/ppc64/kfreebsd-amd64/s390x/
1104
biarch64archs := /i386/powerpc/sparc/s390/mips/mipsel/
1105
biarchn32archs := /mips/mipsel/
1106
ifeq ($(distribution),Ubuntu)
1107
ifeq (,$(filter $(distrelease),dapper hardy jaunty karmic lucid maverick natty))
1108
biarchhfarchs := /armel/
1109
biarchsfarchs := /armhf/
1112
$(foreach x,32 64 n32 hf sf,$(eval $(call gen_biarch,$(x))))
1114
#ifeq ($(DEB_TARGET_ARCH),ia64)
1118
ifeq ($(trunk_build),yes)
1119
no_biarch_libs := yes
1121
ifdef DEB_CROSS_NO_BIARCH
1122
no_biarch_libs := yes
1124
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
1125
no_biarch_libs := yes
1128
ifeq ($(no_biarch_libs),yes)
1131
with_lib64cxxdbg := no
1132
with_lib64objc := no
1135
with_lib64gfortran := no
1136
with_lib64mudflap := no
1139
with_lib64gomp := no
1141
with_lib64qmath := no
1145
with_lib32cxxdbg := no
1146
with_lib32objc := no
1149
with_lib32gfortran := no
1150
with_lib32mudflap := no
1153
with_lib32gomp := no
1155
with_lib32qmath := no
1157
with_libn32gcc := no
1158
with_libn32cxx := no
1159
with_libn32cxxdbg := no
1160
with_libn32objc := no
1161
with_libn32ffi := no
1162
with_libn32gcj := no
1163
with_libn32gfortran := no
1164
with_libn32mudflap := no
1165
with_libn32ssp := no
1167
with_libn32gomp := no
1168
with_libn32itm := no
1169
with_libn32qmath := no
1173
with_libhfcxxdbg := no
1174
with_libhfobjc := no
1177
with_libhfgfortran := no
1178
with_libhfmudflap := no
1181
with_libhfgomp := no
1183
with_libhfqmath := no
1187
with_libsfcxxdbg := no
1188
with_libsfobjc := no
1191
with_libsfgfortran := no
1192
with_libsfmudflap := no
1195
with_libsfgomp := no
1197
with_libsfqmath := no
1199
with_java_plugin := no
1201
ifdef DEB_CROSS_NO_BIARCH
1202
biarch64 := disabled by DEB_CROSS_NO_BIARCH
1203
biarch32 := disabled by DEB_CROSS_NO_BIARCH
1204
biarchn32 := disabled by DEB_CROSS_NO_BIARCH
1205
biarchhf := disabled by DEB_CROSS_NO_BIARCH
1206
biarchsf := disabled by DEB_CROSS_NO_BIARCH
1209
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
1210
biarch64 := disabled for D
1211
biarch32 := disabled for D
1212
biarchn32 := disabled for D
1213
biarchhf := disabled for D
1214
biarchsf := disabled for D
1219
ifneq (,$(filter yes,$(biarch32) $(biarch64) $(biarchn32) $(biarchhf) $(biarchsf)))
1223
multilib_archs = $(sort $(subst /, , $(biarch64archs) $(biarch32archs) $(biarchn32archs) $(biarchhfarchs) $(biarchsfarchs)))
1226
$(if $(filter yes,$(biarch64)),$(biarch64subdir),) \
1227
$(if $(filter yes,$(biarch32)),$(biarch32subdir),) \
1228
$(if $(filter yes,$(biarchn32)),$(biarchn32subdir),) \
1229
$(if $(filter yes,$(biarchhf)),$(biarchhfsubdir),) \
1230
$(if $(filter yes,$(biarchsf)),$(biarchsfsubdir),)
1231
biarchsubdirs := {$(strip $(shell echo $(biarchsubdirs) | tr " " ","))}
1233
ifeq ($(biarch32),yes)
1234
with_32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
1235
$(shell cat build/runcheck.out), \
1236
$(shell CC="gcc -m32" bash debian/runcheck.sh)))
1239
ifeq ($(biarch64),yes)
1240
ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),mips mipsel))
1241
with_64bit_check := $(strip $(if $(wildcard build/runcheck.out), \
1242
$(shell cat build/runcheck.out), \
1243
$(shell CC="gcc -mabi=64" bash debian/runcheck.sh)))
1245
with_64bit_check := $(strip $(if $(wildcard build/runcheck.out), \
1246
$(shell cat build/runcheck.out), \
1247
$(shell CC="gcc -m64" bash debian/runcheck.sh)))
1251
ifeq ($(biarchn32),yes)
1252
with_n32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
1253
$(shell cat build/runcheck.out), \
1254
$(shell CC="gcc -mabi=n32" bash debian/runcheck.sh)))
1258
force_gnu_locales := yes
1260
locale_no_systems := knetbsd-gnu
1261
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
1262
force_gnu_locales := disabled for system $(DEB_TARGET_GNU_SYSTEM)
1265
gcc_tarpath := $(firstword $(wildcard gcc-*.tar.* /usr/src/gcc-$(BASE_VERSION)/gcc-*.tar.*))
1266
gcc_tarball := $(notdir $(gcc_tarpath))
1267
gcc_srcdir := $(subst -dfsg,,$(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gcc_tarball:.tar.bz2=)))))
1269
ifeq ($(with_d),yes)
1270
gdc_tarpath := $(firstword $(wildcard gdc-*.tar.* /usr/src/gcc-$(BASE_VERSION)/gdc-*.tar.*))
1271
gdc_tarball := $(notdir $(gdc_tarpath))
1272
gdc_srcdir := $(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gdc_tarball:.tar.bz2=))))
1275
ecj_jar := $(firstword $(wildcard ecj.jar /usr/share/java/eclipse-ecj.jar /usr/share/java/ecj.jar))
1277
unpack_stamp := $(stampdir)/01-unpack-stamp
1278
pre_patch_stamp := $(stampdir)/02-pre-patch-stamp
1279
patch_stamp := $(stampdir)/02-patch-stamp
1280
src_spu_stamp := $(stampdir)/02-src-spu-stamp
1281
control_stamp := $(stampdir)/03-control-stamp
1282
configure_stamp := $(stampdir)/04-configure-stamp
1283
build_stamp := $(stampdir)/05-build-stamp
1284
build_html_stamp := $(stampdir)/05-build-html-stamp
1285
build_locale_stamp := $(stampdir)/05-build-locale-stamp
1286
build_doxygen_stamp := $(stampdir)/05-build-doxygen-stamp
1287
build_javasrc_stamp := $(stampdir)/05-build-javasrc-stamp
1288
build_javadoc_stamp := $(stampdir)/05-build-javadoc-stamp
1289
check_stamp := $(stampdir)/06-check-stamp
1290
check_inst_stamp := $(stampdir)/06-check-inst-stamp
1291
install_stamp := $(stampdir)/07-install-stamp
1292
install_snap_stamp := $(stampdir)/07-install-snap-stamp
1293
binary_stamp := $(stampdir)/08-binary-stamp
1295
configure_dummy_stamp := $(stampdir)/04-configure-dummy-stamp
1296
build_dummy_stamp := $(stampdir)/05-build-dummy-stamp
1297
install_dummy_stamp := $(stampdir)/07-install-dummy-stamp
1299
configure_hppa64_stamp := $(stampdir)/04-configure-hppa64-stamp
1300
build_hppa64_stamp := $(stampdir)/05-build-hppa64-stamp
1301
install_hppa64_stamp := $(stampdir)/07-install-hppa64-stamp
1303
configure_neon_stamp := $(stampdir)/04-configure-neon-stamp
1304
build_neon_stamp := $(stampdir)/05-build-neon-stamp
1305
install_neon_stamp := $(stampdir)/07-install-neon-stamp
1307
configure_spu_stamp := $(stampdir)/04-configure-spu-stamp
1308
build_spu_stamp := $(stampdir)/05-build-spu-stamp
1309
install_spu_stamp := $(stampdir)/07-install-spu-stamp
1311
control_dependencies := $(patch_stamp)
1313
ifeq ($(single_package),yes)
1314
configure_dependencies = $(configure_stamp)
1315
build_dependencies = $(build_stamp)
1316
install_dependencies = $(install_snap_stamp)
1317
ifeq ($(with_check),yes)
1318
check_dependencies += $(check_stamp)
1321
ifeq ($(with_base_only),yes)
1322
configure_dependencies = $(configure_dummy_stamp)
1323
build_dependencies = $(build_dummy_stamp)
1324
install_dependencies = $(install_dummy_stamp)
1326
configure_dependencies = $(configure_stamp)
1327
build_dependencies = $(build_stamp)
1328
install_dependencies = $(install_stamp)
1329
ifeq ($(with_check),yes)
1330
check_dependencies += $(check_stamp)
1335
ifneq (,$(findstring gcj-, $(PKGSOURCE)))
1336
ifeq ($(with_gcj_base_only),yes)
1337
configure_dependencies = $(configure_dummy_stamp)
1338
build_dependencies = $(build_dummy_stamp)
1339
install_dependencies = $(install_dummy_stamp)
1343
ifeq ($(with_neon),yes)
1344
build_dependencies += $(build_neon_stamp)
1345
install_dependencies += $(install_neon_stamp)
1348
ifeq ($(with_hppa64),yes)
1349
build_dependencies += $(build_hppa64_stamp)
1350
ifneq ($(trunk_build),yes)
1351
install_dependencies += $(install_hppa64_stamp)
1355
ifeq ($(with_spu),yes)
1356
control_dependencies += $(src_spu_stamp)
1357
build_dependencies += $(build_spu_stamp)
1358
ifneq ($(trunk_build),yes)
1359
install_dependencies += $(install_spu_stamp)
1363
build_dependencies += $(check_dependencies)
1366
mkdir -p $(stampdir)
1368
ifeq ($(DEB_CROSS),yes)
1369
define cross_mangle_shlibs
1370
sed -i s/$(cross_lib_arch)//g debian/$(1)/DEBIAN/shlibs
1372
define cross_mangle_substvars
1373
sed -i 's/lib[^ ,(]*/&$(cross_lib_arch)/g' debian/$(1).substvars
1376
define cross_mangle_shlibs
1378
define cross_mangle_substvars
1382
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
1383
define cross_mangle_control
1384
$(if $(findstring 64,$(1)),sed -i -r '/^(Dep|Rec|Sug)/s/[a-z0-9-]+32[^$(COMMA)]+($(COMMA) *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_l64gcc)/;/^(Dep|Rec|Sug)/s/ *$(COMMA) *$$//' debian/$(1)/DEBIAN/control,@:)
1385
$(if $(findstring n32,$(1)),sed -i -r '/^(Dep|Rec|Sug)/s/[a-z0-9-]+64[^$(COMMA)]+($(COMMA) *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_ln32gcc)/;/^(Dep|Rec|Sug)/s/ *$(COMMA) *$$//' debian/$(1)/DEBIAN/control,@:)
1388
define cross_mangle_control