File: rules.conf

package info (click to toggle)
gcc-4.8 4.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 587,180 kB
  • ctags: 425
  • sloc: makefile: 65,711; sh: 1,248; perl: 165; awk: 23; cpp: 14
file content (1223 lines) | stat: -rw-r--r-- 45,405 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
# -*- makefile -*-
# rules.conf
#	- used to build debian/control and debian/rules.parameters
#	- assumes unpacked sources

include debian/rules.defs
include debian/rules.sonames

# manual ...
ifeq ($(DEB_TARGET_GNU_CPU), $(findstring $(DEB_TARGET_GNU_CPU),hppa m68k))
  ifeq ($(DEB_TARGET_ARCH),m68k)
    GCC_SONAME := 2
  endif
  ifeq ($(DEB_TARGET_ARCH),hppa)
    GCC_SONAME := 4
  endif
  DEB_LIBGCC_SOVERSION := $(DEB_SOVERSION)
  DEB_LIBGCC_VERSION := $(DEB_VERSION)
else
  GCC_SONAME := 1
  DEB_LIBGCC_SOVERSION := $(DEB_SOEVERSION)
  DEB_LIBGCC_VERSION := $(DEB_EVERSION)
endif

_soname_map = gcc=$(GCC_SONAME) stdc++=$(CXX_SONAME) gomp=$(GOMP_SONAME) \
	ssp=$(SSP_SONAME) gfortran=$(FORTRAN_SONAME) \
	itm=$(ITM_SONAME) objc=$(OBJC_SONAME) quadmath=$(QUADMATH_SONAME) \
	go=$(GO_SONAME) backtrace=$(BTRACE_SONAME) \
	atomic=$(ATOMIC_SONAME) asan=$(ASAN_SONAME) tsan=$(TSAN_SONAME)
_soname = $(patsubst $(1)=%,%,$(filter $(1)=%,$(_soname_map)))

# $(call _lib_name,<name>,<biarch>,<ext>)
_lib_name = $(subst $(SPACE),, \
  lib$(2)$(1) \
  $(if $(filter dev,$(3)),,$(call _soname,$(1))) \
  $(if $(or $(filter $(3),dev),$(and $(filter $(3),dbg),$(filter $(1),stdc++))),-$(BASE_VERSION)) \
  $(if $(3),-$(3))$(LS)$(AQ))
# $(call _lib_vers,<ext>,<vers>) 
_lib_vers = ($(if $(filter $(1),dev),=,>=) $(2))

# Helper to generate biarch/triarch dependencies.
# For example, $(eval $(call gen_multilib_deps,gomp)) will create the
# libgompbiarch variable, and make it contains the libgompbiarch{32,64,n32}
# variables if biarch{32,64,n32} is set to yes.

define gen_multilib_deps
  lib$1biarch64$2  := $(call _lib_name,$(1),64,$(2)) $(call _lib_vers,$(2),$(3))
  lib$1biarch32$2  := $(call _lib_name,$(1),32,$(2)) $(call _lib_vers,$(2),$(3))
  lib$1biarchn32$2 := $(call _lib_name,$(1),n32,$(2)) $(call _lib_vers,$(2),$(3))
  lib$1biarchx32$2 := $(call _lib_name,$(1),x32,$(2)) $(call _lib_vers,$(2),$(3))
  lib$1biarchhf$2  := $(call _lib_name,$(1),hf,$(2)) $(call _lib_vers,$(2),$(3))
  lib$1biarchsf$2  := $(call _lib_name,$(1),sf,$(2)) $(call _lib_vers,$(2),$(3))
  ifeq ($$(biarch64),yes)
    lib$1biarch$2 := $$(lib$1biarch64$2)
  endif
  ifeq ($$(biarch32),yes)
    ifeq ($$(biarch64),yes)
      lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarch32$2)
    else
      lib$1biarch$2 := $$(lib$1biarch32$2)
    endif
  endif
  ifeq ($$(biarchx32),yes)
    ifeq ($$(biarch64),yes)
      lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarchx32$2)
    else ifeq ($$(biarch32),yes)
      lib$1biarch$2 := $$(lib$1biarch32$2), $$(lib$1biarchx32$2)
    else
      lib$1biarch$2 := $$(lib$1biarchx32$2)
    endif
  endif
  ifeq ($$(biarchn32),yes)
    ifeq ($$(biarch64),yes)
      lib$1biarch$2 := $$(lib$1biarch64$2), $$(lib$1biarchn32$2)
    else ifeq ($$(biarch32),yes)
      lib$1biarch$2 := $$(lib$1biarch32$2), $$(lib$1biarchn32$2)
    else
      lib$1biarch$2 := $$(lib$1biarchn32$2)
    endif
  endif
  ifeq ($$(biarchhf),yes)
    lib$1biarch$2 := $$(lib$1biarchhf$2) | $(call _lib_name,$(1),hf,$(2))
  endif
  ifeq ($$(biarchsf),yes)
    lib$1biarch$2 := $$(lib$1biarchsf$2) | $(call _lib_name,$(1),sf,$(2))
  endif
endef
ifeq ($(with_shared_libgcc),yes)
  LIBGCC_DEP := libgcc$(GCC_SONAME)$(LS)$(AQ) (>= $(DEB_LIBGCC_VERSION))
  $(eval $(call gen_multilib_deps,gcc,,$(DEB_LIBGCC_VERSION)))
endif
LIBGCC_DEV_DEP := libgcc-$(BASE_VERSION)-dev$(LS)$(AQ) (>= $(DEB_VERSION))
$(foreach x,stdc++ gomp ssp gfortran itm objc atomic asan quadmath go, \
	$(eval $(call gen_multilib_deps,$(x),,$$$${gcc:Version})))
$(foreach x,gcc stdc++ gfortran objc go, \
	$(eval $(call gen_multilib_deps,$(x),dev,$$$${gcc:Version})))
$(foreach x,gcc stdc++ gfortran objc go, \
	$(eval $(call gen_multilib_deps,$(x),dbg,$$$${gcc:Version})))

# Helper to generate _no_archs variables.
# For example, $(eval $(call gen_no_archs,java)) will create the java_no_archs
# variable, using the java_no_cpu and java_no_systems variables.
define gen_no_archs
  $1_no_archs :=
  ifneq (,$$($1_no_cpus))
    $1_no_archs += $$(foreach cpu,$$(filter-out i386 amd64 alpha arm,$$($1_no_cpus)),!$$(cpu))
    ifneq (,$$(filter i386,$$($1_no_cpus)))
      $1_no_archs += !i386 !hurd-i386 !kfreebsd-i386
    endif
    ifneq (,$$(filter amd64,$$($1_no_cpus)))
      $1_no_archs += !amd64 !kfreebsd-amd64
    endif
    ifneq (,$$(filter alpha,$$($1_no_cpus)))
      $1_no_archs += !alpha !hurd-alpha
    endif
    ifneq (,$$(filter arm,$$($1_no_cpus)))
      $1_no_archs += !arm !armel !armhf
    endif
    ifneq (,$$(strip $3))
      $1_no_systems_tmp := $$(subst $$(SPACE)gnu$$(SPACE),$$(SPACE)hurd-gnu$$(SPACE),$$(SPACE)$3$$(SPACE))
      $1_no_archs += $$(foreach cpu,$$($1_no_cpus),$$(foreach system,$$($1_no_systems_tmp),!$$(subst gnu,$$(cpu),$$(system))))
    endif
  endif
  ifneq (,$$($1_no_systems))
    $1_no_systems_tmp := $$(subst $$(SPACE)gnu$$(SPACE),$$(SPACE)hurd-gnu$$(SPACE),$$(SPACE)$$($1_no_systems)$$(SPACE))
    $1_no_archs += $$(foreach system,$$($1_no_systems_tmp),$$(foreach cpu,$2,!$$(subst gnu,$$(cpu),$$(system))))
  endif
  $1_no_archs := $$(strip $$($1_no_archs))
endef
base_deb_cpus := amd64 i386 alpha
base_deb_systems :=
$(foreach x,ada java java_plugin fortran libphobos libgc check locale,$(eval $(call gen_no_archs,$(x),$(base_deb_cpus),$(base_deb_systems))))
linux_no_archs := !hurd-any !kfreebsd-any

GCC_VERSION := $(strip $(shell cat $(firstword $(wildcard $(srcdir)/gcc/FULL-VER $(srcdir)/gcc/BASE-VER))))
NEXT_GCC_VERSION := $(shell echo $(GCC_VERSION) | \
	awk -F. '{OFS="."; if (NF==2) $$3=1; else $$NF += 1; print}')
GCC_MAJOR_VERSION := $(shell echo $(GCC_VERSION)   | sed -r 's/([0-9])\.[0-9]\.[0-9]/\1/')
GCC_MINOR_VERSION := $(shell echo $(GCC_VERSION)   | sed -r 's/[0-9]\.([0-9])\.[0-9]/\1/')
GCC_RELEASE_VERSION := $(shell echo $(GCC_VERSION) | sed -r 's/[0-9]\.[0-9]\.([0-9])/\1/')
NEXT_GCC_MAJOR_VERSION := $(shell expr $(echo $(GCC_MAJOR_VERSION)) + 1)
NEXT_GCC_MINOR_VERSION := $(shell expr $(echo $(GCC_MINOR_VERSION)) + 1)
NEXT_GCC_RELEASE_VERSION := $(shell expr $(echo $(GCC_MAJOR_VERSION)) + 1)

ifeq ($(single_package),yes)
  BASE_VERSION := $(shell echo $(GCC_VERSION) | sed -e 's/\([1-9]\.[0-9]\).*/\1/')
endif

GCC_SOURCE_VERSION := $(shell echo $(DEB_VERSION) | sed 's/-.*//')
NEXT_GCC_SOURCE_VERSION := $(shell echo $(GCC_SOURCE_VERSION) | \
	awk -F. '{OFS="."; if (NF==2) $$3=1; else $$NF += 1; print}')

MAINTAINER = Debian GCC Maintainers <debian-gcc@lists.debian.org>
ifeq ($(distribution),Ubuntu)
  ifneq (,$(findstring $(PKGSOURCE),gnat gdc))
    MAINTAINER = Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
  else
    MAINTAINER = Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
  endif
endif

UPLOADERS = Matthias Klose <doko@debian.org>
ifneq (,$(findstring $(PKGSOURCE),gnat))
  UPLOADERS = Ludovic Brenta <lbrenta@debian.org>
endif
ifneq (,$(findstring $(PKGSOURCE),gdc))
  UPLOADERS = Iain Buclaw <ibuclaw@ubuntu.com>, Matthias Klose <doko@debian.org>
endif

DPKGV = 1.14.15
ifeq ($(with_multiarch_lib),yes)
  DPKGV = 1.16.0~ubuntu4
endif
ifeq ($(multiarch_stage1),yes)
  DPKGV = 1.16.0~ubuntu4
endif
ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring saucy trusty utopic))
  DPKGV = 1.17.11
endif
DPKG_BUILD_DEP = dpkg-dev (>= $(DPKGV)),

ifeq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH))
  TARGET_QUAL = :$(DEB_TARGET_ARCH)
endif

# The binutils version needed.
# The oldest suitable versions for the various platforms can be found in
# INSTALL/specific.html ; we take a tighter dependency if possible to be on
# the safe side (something like newest( version in stable, versions for the
# various platforms in INSTALL/specific.html) ).
# We need binutils (>= 2.19.1) for a new dwarf unwind expression opcode.
# See http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01713.html
ifeq ($(trunk_build),yes)
  BINUTILSBDV = 2.23
else
  BINUTILSBDV = 2.22
  ifneq (,$(filter $(distrelease),jessie sid vivid))
    BINUTILSBDV = 2.24.90.20141219
  endif
endif
ifeq ($(DEB_CROSS),yes)
  BINUTILS_BUILD_DEP = binutils$(TS) (>= $(BINUTILSBDV)), binutils-multiarch (>= $(BINUTILSBDV))
  BINUTILSV := $(shell dpkg -l binutils$(TS) \
			| awk '/^ii/{print $$3;exit}' | sed 's/-.*//')
else
  BINUTILS_BUILD_DEP = binutils (>= $(BINUTILSBDV)) | binutils-multiarch (>= $(BINUTILSBDV))
  ifeq ($(REVERSE_CROSS),yes)
    BINUTILSV := $(shell dpkg -l binutils$(TS) \
			| awk '/^ii/{print $$3;exit}' | sed 's/-.*//')
  else
    BINUTILSV := $(shell dpkg -l binutils binutils-multiarch \
			| awk '/^ii/{print $$3;exit}' | sed 's/-.*//')
  endif
endif
ifeq (,$(BINUTILSV))
  BINUTILSV := $(BINUTILSBDV)
endif

# FIXME; stripping doesn't work with gold
#BINUTILS_BUILD_DEP += , binutils-gold (>= $(BINUTILSV)) [$(gold_archs)]

# libc-dev dependencies
libc_ver := 2.11
libc_dev_ver := $(libc_ver)
ifeq ($(with_multiarch_lib),yes)
  ifeq ($(derivative),Debian)
    libc_dev_ver := 2.13-5
    #ifeq (,$(filter arm, $(go_no_cpus)))
    #  libc_dev_ver := 2.13-31
    #endif
  else
    libc_dev_ver := 2.13-0ubuntu6
  endif
endif
ifeq ($(DEB_TARGET_ARCH_OS),linux)
  ifneq (,$(findstring $(DEB_TARGET_ARCH),alpha ia64))
    LIBC_DEP = libc6.1
  else
    LIBC_DEP = libc6
  endif
else
  ifeq ($(DEB_TARGET_ARCH_OS),hurd)
    LIBC_DEP = libc0.3
  endif
  ifeq ($(DEB_TARGET_ARCH_OS),kfreebsd)
    LIBC_DEP = libc0.1
  endif
  ifeq ($(DEB_TARGET_ARCH),uclibc)
       LIBC_DEP ?= libuclibc
       LIBC_DEV_DEP ?= libuclibc-dev
  endif
endif
LIBC_DEV_DEP = $(LIBC_DEP)-dev
# for cross
ifeq ($(DEB_CROSS),yes)
  LIBC_DEP ?= $(LIBC_DEP)$(LS)$(AQ)
  LIBC_DEV_DEP ?= $(LIBC_DEV_DEP)$(LS)$(AQ)
else
  LIBC_DBG_DEP = libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg,
endif

# this is about Debian archs name, *NOT* GNU target triplet
biarch_deb_map := \
	i386=amd64 amd64=i386 \
	mips=mips64 mipsel=mips64 \
	powerpc=ppc64 ppc64=powerpc \
	sparc=sparc64 sparc64=sparc\
	s390=s390x s390x=s390 \
	kfreebsd-amd64=i386 \
	armel=armhf \
	armhf=armel
biarch_deb_arch := $(patsubst $(DEB_TARGET_ARCH)=%,%, \
	$(filter $(DEB_TARGET_ARCH)=%,$(biarch_deb_map)))

LIBC_BIARCH_DEP :=
LIBC_BIARCH_DEV_DEP :=
ifneq (,$(findstring yes,$(biarch64) $(biarch32) $(biarchn32) $(biarchx32)$(biarchhf)$(biarchsf)))
  LIBC_BIARCH_DEP := $${shlibs:Depends}
  LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_ver))
  # amd64, x32, i386
  ifneq (,$(findstring $(DEB_TARGET_ARCH),amd64 x32 i386))
  ifeq ($(biarch64)$(biarch32),yesyes)
    LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-amd64$(LS)$(AQ) (>= $(libc_ver)), $(LIBC_DEV_DEP)-i386$(LS)$(AQ) (>= $(libc_ver))
  endif
  ifeq ($(biarch64)$(biarchx32),yesyes)
    LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-amd64$(LS)$(AQ) (>= $(libc_ver)), $(LIBC_DEV_DEP)-x32$(LS)$(AQ) (>= $(libc_ver))
  endif
  ifeq ($(biarch32)$(biarchx32),yesyes)
    LIBC_BIARCH_DEV_DEP := $(LIBC_DEV_DEP)-i386$(LS)$(AQ) (>= $(libc_ver)), $(LIBC_DEV_DEP)-x32$(LS)$(AQ) (>= $(libc_ver))
  endif
  endif
  # mips*
  ifneq (,$(findstring $(DEB_TARGET_ARCH),mips mipsel mipsn32 mipsn32el mips64 mips64el))
  ifeq ($(biarchn32)$(biarch32),yesyes)
      LIBC_BIARCH_DEV_DEP := libc6-dev-mips32$(LS)$(AQ) (>= $(libc_ver)), libc6-dev-mipsn32$(LS)$(AQ) (>= $(libc_ver))
  endif
  ifeq ($(biarch64)$(biarch32),yesyes)
      triarch := $(COMMA)$(SPACE)
      LIBC_BIARCH_DEV_DEP := libc6-dev-mips32$(LS)$(AQ) (>= $(libc_ver)), libc6-dev-mips64$(LS)$(AQ) (>= $(libc_ver))
  endif
  ifeq ($(biarchn32)$(biarch64),yesyes)
      triarch := $(COMMA)$(SPACE)
      LIBC_BIARCH_DEV_DEP := libc6-dev-mips64$(LS)$(AQ) (>= $(libc_ver)), libc6-dev-mipsn32$(LS)$(AQ) (>= $(libc_ver))
  endif
  endif

  ifeq ($(biarchhf),yes)
    LIBC_BIARCH_DEP := $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_ver))
    LIBC_BIARCH_DEP += | $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ)
    LIBC_BIARCH_DEV_DEP += | $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ)
  endif
  ifeq ($(biarchsf),yes)
    LIBC_BIARCH_DEP := $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ) (>= $(libc_ver))
    LIBC_BIARCH_DEP += | $(LIBC_DEP)-$(biarch_deb_arch)$(LS)$(AQ)
    LIBC_BIARCH_DEV_DEP += | $(LIBC_DEV_DEP)-$(biarch_deb_arch)$(LS)$(AQ)
  endif
endif

# Add suffix and required version
LIBC_DEV_DEP := $(LIBC_DEV_DEP)$(LS)$(AQ) (>= $(libc_dev_ver))
# TODO: make this automatic, there must be a better way to define LIBC_DEP.
ifneq ($(DEB_CROSS),yes)
  LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_dev_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_dev_ver)) [hurd-i386] | libc0.1-dev (>= $(libc_dev_ver)) [kfreebsd-i386 kfreebsd-amd64] | libc6-dev (>= $(libc_dev_ver))
  ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty oneiric))
    LIBC_BUILD_DEP += , libc6-dev (>= 2.13-31) [armel armhf]
  endif
  LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el s390x sparc64 x32], libn32gcc1 [mips mipsel mips64 mips64el], lib64gcc1 [i386 mips mipsel mipsn32 mipsn32el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el],
  ifneq (,$(findstring amd64,$(biarchx32archs)))
  LIBC_BIARCH_BUILD_DEP += libc6-dev-x32 [amd64 i386], libx32gcc1 [amd64 i386],
endif
ifneq (,$(findstring armel,$(biarchhfarchs)))
  LIBC_BIARCH_BUILD_DEP += libc6-dev-armhf [armel], libhfgcc1 [armel],
endif
ifneq (,$(findstring armhf,$(biarchsfarchs)))
  LIBC_BIARCH_BUILD_DEP += libc6-dev-armel [armhf], libsfgcc1 [armhf],
endif
else
  LIBC_BUILD_DEP = $(LIBC_DEV_DEP),
  ifneq ($(LIBC_BIARCH_DEV_DEP),)
    LIBC_BIARCH_BUILD_DEP = $(LIBC_BIARCH_DEV_DEP),
  else
    LIBC_BIARCH_BUILD_DEP =
  endif
endif

# needed for the include/asm symlink to run the testsuite for
# non default multilibs
GCC_MULTILIB_BUILD_DEP = g++-multilib [$(multilib_archs)],

LIBUNWIND_DEV_DEP := libunwind7-dev$(LS)$(AQ) (>= 0.98.5-6)
LIBUNWIND_BUILD_DEP := $(LIBUNWIND_DEV_DEP) [ia64],
LIBATOMIC_OPS_BUILD_DEP := libatomic-ops-dev$(LS) [ia64],
ifneq ($(DEB_TARGET_ARCH),ia64)
  LIBUNWIND_DEV_DEP := # nothing
endif

ifneq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty))
  GMP_BUILD_DEP = libgmp3-dev | libgmp-dev (>= 2:5.0.1~),
  MPFR_BUILD_DEP = libmpfr-dev,
else
  GMP_BUILD_DEP = libgmp-dev (>= 2:5.0.1~),
  MPFR_BUILD_DEP = libmpfr-dev (>= 3.0.0-9~),
endif

PPL_BUILD_DEP = libisl-dev,
CLOOG_BUILD_DEP = libcloog-isl-dev (>= 0.18),
# FIXME: currently not dl'opened.
#CLOOG_RUNTIME_DEP = libisl10, libcloog-isl4

ifneq (,$(filter $(distrelease),lenny etch squeeze wheezy dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring))
  MPC_BUILD_DEP = libmpc-dev,
else
  MPC_BUILD_DEP = libmpc-dev (>= 1.0),
endif

SOURCE_BUILD_DEP :=
ifeq (,$(findstring gcc,$(PKGSOURCE)))
  SOURCE_BUILD_DEP := gcc-$(BASE_VERSION)-source (>= $(GCC_SOURCE_VERSION)), gcc-$(BASE_VERSION)-source (<< $(NEXT_GCC_SOURCE_VERSION)),
endif

CHECK_BUILD_DEP := dejagnu [$(check_no_archs)],
ifneq (,$(findstring gcc,$(PKGSOURCE)))
  CHECK_BUILD_DEP += autogen,
endif

AUTO_BUILD_DEP := m4, libtool,
AUTO_BUILD_DEP += autoconf2.64,

ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy dapper hardy jaunty karmic lucid maverick natty oneiric precise quantal raring saucy trusty))
  SDT_BUILD_DEP = systemtap-sdt-dev [linux-any kfreebsd-any hurd-any],
endif

# ensure that the common libs, built from the next GCC version are available
ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
  ifneq ($(with_common_libs),yes)
    BASE_BUILD_DEP = gcc-4.9-base,
  endif
endif

ifneq ($(DEB_CROSS),yes)
JAVA_BUILD_DEP := zlib1g-dev, libantlr-java, python, libffi-dev,

ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
  bd_java_archs =
else ifeq ($(single_package)-$(with_java),yes-yes)
  bd_java_archs =
else
  bd_java_archs = $(if $(java_no_archs),$(EMPTY) [$(java_no_archs)])
endif

ifneq (,$(java_awt_peers))
  JAVA_BUILD_DEP += fastjar$(bd_java_archs), libmagic-dev$(bd_java_archs),
  JAVA_BUILD_DEP += libecj-java (>= 3.3.0-2)$(bd_java_archs), zip$(bd_java_archs),
  ifeq ($(with_java_maintainer_mode),yes)
    # gcj-4.8 needed for gjavah-4.8.
    JAVA_BUILD_DEP += gcj-4.8$(bd_java_archs), ecj (>= 3.3.0-2)$(bd_java_archs),
  endif
  JAVA_BUILD_DEP += libasound2-dev [$(java_no_archs) $(linux_no_archs)],
  ifneq (,$(findstring gtk,$(java_awt_peers)))
    JAVA_BUILD_DEP += libxtst-dev$(bd_java_archs), libxt-dev$(bd_java_archs), libgtk2.0-dev (>= 2.4.4-2)$(bd_java_archs), libart-2.0-dev$(bd_java_archs), libcairo2-dev$(bd_java_archs),
  endif
  ifneq (,$(findstring qt,$(java_awt_peers)))
    JAVA_BUILD_DEP += libqt4-dev (>= 4.1.0)$(bd_java_archs),
  endif
  # gconf peer, disabled by default
  #JAVA_BUILD_DEP += libgconf2-dev$(bd_java_archs),
  # gstreamer peer
  #JAVA_BUILD_DEP += libgstreamer-plugins-base0.10-dev$(bd_java_archs),
  ifneq ($(single_package),yes)
    JAVA_BUILD_DEP += g++-4.8 [armel armhf],
  endif
endif
ifneq ($(with_standalone_gcj),yes)
  ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
    JAVA_BUILD_DEP += $(SOURCE_BUILD_DEP)
  endif
endif
#JAVA_BUILD_INDEP := gcj-$(BASE_VERSION)-jdk
ifeq ($(single_package),yes)
  LIBSTDCXX_BUILD_INDEP = doxygen (>= 1.7.2), graphviz (>= 2.2), ghostscript, texlive-latex-base
  LIBSTDCXX_BUILD_INDEP +=, xsltproc, libxml2-utils, docbook-xsl-ns
  JAVA_BUILD_INDEP :=
endif
ifeq ($(with_separate_libgcj),yes)
  ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
    JAVA_BUILD_DEP :=
    JAVA_BUILD_INDEP :=
  endif
endif

ifeq ($(with_ecj),yes)
  ifneq (./,$(dir $(ecj_jar)))
    ECJ_DEP = libecj-java (>= 3.5.1)
  endif
else
  ECJ_DEP = ecj, libecj-java (>= 3.5.1)
  ECJ_DEP = ecj-gcj, libecj-java-gcj (>= 3.5.1)
  ifneq (,$(filter $(DEB_HOST_ARCH),arm armel armhf))
    ECJ_DEP +=, ecj1
  endif
endif

ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
  LIBSTDCXX_BUILD_INDEP = doxygen (>= 1.7.2), graphviz (>= 2.2), ghostscript, texlive-latex-base
  ifeq (,$(filter $(distrelease),lenny etch dapper hardy jaunty karmic lucid maverick natty oneiric))
    LIBSTDCXX_BUILD_INDEP +=, xsltproc, libxml2-utils, docbook-xsl-ns
  endif
  JAVA_BUILD_INDEP :=, $(JAVA_BUILD_INDEP)
endif

# FIXME: needs zlib?
GO_BUILD_DEP := g++-4.6,
GO_BUILD_DEP := netbase,

ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
  ifneq ($(with_separate_gnat),yes)
    # Build gnat as part of the combiled gcc-x.y source package.  Do not fail
    # if gnat is not present on unsupported architectures; the build scripts
    # will not use gnat anyway.
    #GNAT_BUILD_DEP := gnat (>= 4.1) [$(ada_no_archs)],
    GNAT_BUILD_DEP := gnat (>= 4.1) [!arm !armhf !arm64 !powerpcspe !ppc64el !sh4 !sparc64 !hurd-i386],
  endif
else ifeq ($(single_package),yes)
  # Ditto, as part of the gcc-snapshot package.
  # FIXME: ad hoc dependency, better fix setting of ada_no_archs
  #GNAT_BUILD_DEP := gnat (>= 4.1) [$(ada_no_archs)], gcc-snapshot (>= 20090821-1) [armel armhf],
  GNAT_BUILD_DEP := gnat (>= 4.1) [!arm !armhf !arm64 !powerpcspe !ppc64el !sh4 !sparc64 !hurd-i386],
else ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
  # Special source package just for gnat. Fail early if gnat is not present,
  # rather than waste CPU cycles and fail later.
  GNAT_BUILD_DEP := gnat (>= 4.1), g++-$(BASE_VERSION),
  GNAT_BUILD_DEP += $(SOURCE_BUILD_DEP)
  ifeq ($(distribution),Ubuntu)
    GNAT_BUILD_DEP += gcc-4.6-multilib [armel armhf],
  endif
  JAVA_BUILD_DEP :=
  JAVA_BUILD_INDEP :=
  GDC_BUILD_DEP :=
  GO_BUILD_DEP :=
else ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
  # Special source package just for gcj.
  GNAT_BUILD_DEP :=
  GDC_BUILD_DEP :=
  GO_BUILD_DEP :=
else ifeq ($(PKGSOURCE),gdc-$(BASE_VERSION))
  # Special source package just for gdc.
  GNAT_BUILD_DEP :=
  JAVA_BUILD_DEP :=
  JAVA_BUILD_INDEP :=
  GDC_BUILD_DEP := $(SOURCE_BUILD_DEP)
  GO_BUILD_DEP :=
else ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION))
  # Special source package just for gccgo.
  GNAT_BUILD_DEP :=
  JAVA_BUILD_DEP :=
  JAVA_BUILD_INDEP :=
  GDC_BUILD_DEP := $(SOURCE_BUILD_DEP)
endif

else
# build cross compiler
  CROSS_BUILD_DEP := libc6-dev$(cross_lib_arch),
ifeq ($(REVERSE_CROSS),yes)
  CROSS_BUILD_DEP += zlib1g-dev$(cross_lib_arch), libmpfr-dev$(cross_lib_arch),
endif
  SOURCE_BUILD_DEP :=
  ifeq (,$(findstring gcc,$(PKGSOURCE)))
    SOURCE_BUILD_DEP := gcc-$(BASE_VERSION)-source (>= $(GCC_SOURCE_VERSION)), gcc-$(BASE_VERSION)-source (<< $(NEXT_GCC_SOURCE_VERSION)),
  endif
  ifeq ($(with_java),yes)
    JAVA_BUILD_DEP := zlib1g-dev, lib64z1-dev [i386 powerpc sparc s390], lib32z1-dev [amd64 ppc64 kfreebsd-amd64 s390x],
  endif
  JAVA_BUILD_INDEP :=
  GNAT_BUILD_DEP :=
endif # cross compiler

# The numeric part of the gcc version number (x.yy.zz)
NEXT_GCC_VERSION := $(shell echo $(GCC_VERSION) | \
		awk -F. '{OFS="."; if (NF==2) $$3=1; else $$NF += 1; print}')
# first version with a new path component in gcc_lib_dir (i.e. GCC_VERSION
# or TARGET_ALIAS changes), or last version available for all architectures
DEB_GCC_SOFT_VERSION := 4.8
DEB_GCJ_SOFT_VERSION := 4.8

ifeq ($(with_d),yes)
  GDC_VERSION := $(BASE_VERSION)
  DEB_GDC_VERSION := $(DEB_VERSION)
endif

# semiautomatic ...
DEB_SOVERSION		:= $(DEB_VERSION)
DEB_SOVERSION		:= 4.8
DEB_SOEVERSION		:= $(EPOCH):4.8
DEB_STDCXX_SOVERSION	:= 4.8
DEB_GCJ_SOVERSION	:= 4.8
DEB_GOMP_SOVERSION	:= $(DEB_SOVERSION)
DEB_GCCMATH_SOVERSION	:= $(DEB_SOVERSION)

DEB_GCC_VERSION := $(DEB_VERSION)
DEB_GCJ_VERSION := $(DEB_VERSION)
ifeq ($(with_separate_libgcj),yes)
  ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
    DEB_GCC_VERSION := $(DEB_GCC_SOFT_VERSION)
  endif
endif

DEB_GNAT_VERSION := $(DEB_VERSION)
ifeq ($(with_separate_gnat),yes)
  ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
    DEB_GCC_VERSION := $(DEB_GCC_SOFT_VERSION)
  endif
endif

GNAT_VERSION := $(BASE_VERSION)

LIBGNAT_DEP :=
ifeq ($(with_libgnat),yes)
  LIBGNAT_DEP := libgnat-$(GNAT_VERSION) (= $(DEB_VERSION))
endif

pkg_ver := -$(BASE_VERSION)

PKG_GCJ_EXT = $(GCJ_SONAME1)
PKG_LIBGCJ_EXT = $(GCJ_SONAME1)$(if $(GCJ_SONAME2),-$(GCJ_SONAME2))

ctrl_flags = \
	-DBINUTILSV=$(BINUTILSV) \
	-DBINUTILSBDV=$(BINUTILSBDV) \
	-DSRCNAME=$(PKGSOURCE) \
	-D__$(DEB_TARGET_GNU_CPU)__ \
	-DARCH=$(DEB_TARGET_ARCH) \
	-DDIST=$(distribution)

ctrl_flags += \
	-DLIBC_DEV_DEP="$(LIBC_DEV_DEP)" \
	-DLIBC_BIARCH_BUILD_DEP="$(LIBC_BIARCH_BUILD_DEP)" \
	-DLIBC_DBG_DEP="$(LIBC_DBG_DEP)" \
	-DFORTRAN_BUILD_DEP="$(FORTRAN_BUILD_DEP)" \
	-DBASE_BUILD_DEP="$(BASE_BUILD_DEP)" \
	-DGNAT_BUILD_DEP="$(GNAT_BUILD_DEP)" \
	-DJAVA_BUILD_DEP="$(JAVA_BUILD_DEP)" \
	-DGO_BUILD_DEP="$(GO_BUILD_DEP)" \
	-DJAVA_BUILD_INDEP="$(JAVA_BUILD_INDEP)" \
	-DLIBSTDCXX_BUILD_INDEP="$(LIBSTDCXX_BUILD_INDEP)" \
	-DGDC_BUILD_DEP="$(GDC_BUILD_DEP)" \
	-DBINUTILS_BUILD_DEP="$(BINUTILS_BUILD_DEP)" \
	-DLIBC_BUILD_DEP="$(LIBC_BUILD_DEP)" \
	-DCHECK_BUILD_DEP="$(CHECK_BUILD_DEP)" \
	-DAUTO_BUILD_DEP="$(AUTO_BUILD_DEP)" \
	-DSDT_BUILD_DEP="$(SDT_BUILD_DEP)" \
	-DAUTOGEN_BUILD_DEP="$(AUTOGEN_BUILD_DEP)" \
	-DCLOOG_BUILD_DEP="$(CLOOG_BUILD_DEP)" \
	-DGMP_BUILD_DEP="$(GMP_BUILD_DEP)" \
	-DMPFR_BUILD_DEP="$(MPFR_BUILD_DEP)" \
	-DMPC_BUILD_DEP="$(MPC_BUILD_DEP)" \
	-DDPKG_BUILD_DEP="$(DPKG_BUILD_DEP)" \
	-DSOURCE_BUILD_DEP="$(SOURCE_BUILD_DEP)" \
	-DCROSS_BUILD_DEP="$(CROSS_BUILD_DEP)" \
	-DGCC_MULTILIB_BUILD_DEP='$(GCC_MULTILIB_BUILD_DEP)' \
	-DMULTILIB_ARCHS="$(multilib_archs)" \
	-DNEON_ARCHS="$(neon_archs)" \
	-DTP=$(TP) \
	-DTS=$(TS) \
	-DLS=$(LS) \
	-DAQ=$(AQ)

ifeq ($(DEB_CROSS),yes)
  ctrl_flags += \
	-DTARGET=$(DEB_TARGET_ARCH) \
	-DLIBUNWIND_BUILD_DEP="$(LIBUNWIND_BUILD_DEP)" \
	-DLIBATOMIC_OPS_BUILD_DEP="$(LIBATOMIC_OPS_BUILD_DEP)"
  ifeq ($(with_deps_on_target_arch_pkgs),yes)
    ctrl_flags += -DCROSS_ARCH=$(DEB_TARGET_ARCH)
  endif
else
  # add '-DPRI=optional' to ctrl_flags if this is not the default compiler
  # ctrl_flags += \
  #     -DPRI=optional
endif

ifeq ($(with_base_only),yes)
  ctrl_flags += \
	-DBASE_ONLY=yes
endif

ifeq ($(with_multiarch_lib),yes)
  ctrl_flags += \
	-DMULTIARCH=yes
endif

control: control-file readme-bugs-file parameters-file symbols-files copyright-file substvars-file versioned-files check-versions

# stage1 and stage2 compilers are only C
ifdef DEB_STAGE
  languages = c
  addons = cdev plugindev
  ifeq ($(multilib),yes)
    addons += multilib
  endif
  addons += $(if $(findstring armel,$(biarchhfarchs)),armml)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),armml)
  ifeq ($(DEB_STAGE),stage2)
    addons += libgcc gccxbase
    ifeq ($(multilib),yes)
      addons += lib32gcc lib64gcc libn32gcc
      addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gcc)
      addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc)
      addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc)
    endif
  else
    LIBGCC_DEV_DEP :=
  endif
else
languages = c c++ fortran objc objpp
ifeq ($(with_gccbase),yes)
    addons += gccbase
endif
ifeq ($(with_gccxbase),yes)
    addons += gccxbase
endif
addons += cdev c++dev fdev objcdev source objppdev multilib
addons += plugindev
addons += $(if $(findstring armel,$(biarchhfarchs)),armml)
addons += $(if $(findstring armhf,$(biarchsfarchs)),armml)
addons += $(if $(findstring amd64,$(biarchx32archs)),x32dev)
ifeq ($(with_libgcc),yes)
  addons += libgcc lib4gcc lib32gcc lib64gcc libn32gcc
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gcc)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc)
endif
ifeq ($(with_libcxx),yes)
  addons += libcxx lib32cxx lib64cxx libn32cxx
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32cxx)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfcxx)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfcxx)
endif
addons += $(if $(findstring amd64,$(biarchx32archs)),libx32dbgcxx)
addons += $(if $(findstring armel,$(biarchhfarchs)),libhfdbgcxx)
addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfdbgcxx)
ifeq ($(with_libgfortran),yes)
  addons += libgfortran lib32gfortran lib64gfortran libn32gfortran
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gfortran)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgfortran)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgfortran)
endif
ifeq ($(with_libobjc),yes)
  addons += libobjc lib32objc lib64objc libn32objc
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32objc)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfobjc)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfobjc)
endif
ifeq ($(with_libgomp),yes)
  addons += libgomp lib32gomp lib64gomp libn32gomp
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32gomp)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgomp)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgomp)
endif
ifeq ($(with_libitm),yes)
  addons += libitm lib32itm lib64itm libn32itm
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32itm)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfitm)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfitm)
endif
ifeq ($(with_libatomic),yes)
  addons += libatomic lib32atomic lib64atomic libn32atomic
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32atomic)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfatomic)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfatomic)
endif
ifeq ($(with_libbacktrace),yes)
  addons += libbtrace lib32btrace lib64btrace libn32btrace
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32btrace)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfbtrace)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfbtrace)
endif
ifeq ($(with_libasan),yes)
  addons += libasan lib32asan lib64asan libn32asan
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32asan)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfasan)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfasan)
endif
  addons += libtsan
ifeq ($(with_libtsan),yes)
  addons += libtsan #lib32tsan lib64tsan libn32tsan
  #addons += $(if $(findstring amd64,$(biarchx32archs)),libx32tsan)
  #addons += $(if $(findstring armel,$(biarchhfarchs)),libhftsan)
  #addons += $(if $(findstring armhf,$(biarchsfarchs)),libsftsan)
endif
ifeq ($(with_libqmath),yes)
  addons += libqmath lib32qmath lib64qmath libn32qmath
  addons += $(if $(findstring amd64,$(biarchx32archs)),libx32qmath)
  addons += $(if $(findstring armel,$(biarchhfarchs)),libhfqmath)
  addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfqmath)
endif
ifeq ($(with_d),yes)
  languages += d
  ifeq ($(with_libphobos),yes)
    addons += libphobos
  endif
endif
ifeq ($(with_go),yes)
  addons += ggo godev
  ifeq ($(with_libgo),yes)
    addons += libggo lib32ggo lib64ggo libn32ggo
    addons += $(if $(findstring amd64,$(biarchx32archs)),libx32ggo)
  endif
endif

  languages += ada
  addons += libgnat libs source # libgmath libnof lib64gnat ssp

  languages += java
  addons += gcj
  ifneq ($(DEB_CROSS),yes)
    addons += libgcj libgcjdev gcjdoc gcjsrc
  endif

  ifneq ($(DEB_CROSS),yes)
  ifneq (,$(neon_archs))
    addons += libneongcc libneongomp libneonitm libneonobjc libneongfortran libneoncxx
  endif
  ifeq ($(with_fixincl),yes)
    addons += fixincl
  endif
  ifeq ($(with_libgcj_doc),yes)
    addons += gcjdoc
  endif
  endif # DEB_CROSS
#  ifneq (,$(findstring gtk, $(java_awt_peers)))
#    addons += gtkpeer
#  endif
#  ifneq (,$(findstring qt, $(java_awt_peers)))
#    addons += qtpeer
#  endif
  ifeq ($(with_separate_libgcj),yes)
    ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
      languages := $(filter-out java,$(languages))
      addons := $(filter-out gcj libgcj libgcjdev gcjdoc gcjsrc gtkpeer qtpeer,$(addons))
    endif
    ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
      languages = java
      addons = gcj libgcj libgcjdev gcjsrc
      addons += $(if $(filter yes,$(with_gcjbase)),gcjbase)
      addons += $(if $(filter yes,$(with_gcjxbase)),gcjxbase)
    ifeq ($(with_libgcj_doc),yes)
      addons += gcjdoc
    endif
#      ifneq (,$(findstring gtk, $(java_awt_peers)))
#        addons += gtkpeer
#      endif
#      ifneq (,$(findstring qt, $(java_awt_peers)))
#        addons += qtpeer
#      endif
      ifeq ($(with_standalone_gcj),yes)
	addons += libgcc lib4gcc lib64gcc lib32gcc libn32gcc libx32gcc
      endif
    endif
  endif
  ifeq ($(DEB_CROSS),yes)
    addons := $(filter-out gcjdoc gcjsrc,$(addons))
  endif
  ifeq ($(with_standalone_gcj),yes)
    ifeq ($(PKGSOURCE),gcj-$(BASE_VERSION))
      ctrl_flags += -DSTANDALONEJAVA
    endif
  endif
  ifeq ($(with_separate_libgo),yes)
    ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
      languages := $(filter-out go,$(languages))
      addons := $(filter-out ggo godev libggo lib64ggo lib32ggo libn32ggo libx32ggo,$(addons))
    endif
    ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION))
      languages = go
      addons = ggo godev libggo lib64ggo lib32ggo libn32ggo gccbase multilib
      addons += $(if $(findstring amd64,$(biarchx32archs)),libx32ggo)
      # FIXME: use the convenience libgcc ...
      #ifeq ($(with_standalone_go),yes)
      #	addons += libgcc lib4gcc lib64gcc lib32gcc libn32gcc libx32gcc
      #endif
    endif
  endif
  ifeq ($(with_standalone_go),yes)
    ifeq ($(PKGSOURCE),gccgo-$(BASE_VERSION))
      ctrl_flags += -DSTANDALONEGO
    endif
  endif
  ifeq ($(with_separate_gnat),yes)
    ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
      languages := $(filter-out ada,$(languages))
      addons := $(filter-out libgnat,$(addons))
    endif
    ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
      languages = ada
      addons = libgnat
    endif
  endif
  ifeq ($(with_separate_gdc),yes)
    ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION))
      languages := $(filter-out d,$(languages))
    endif
    ifeq ($(PKGSOURCE),gdc-$(BASE_VERSION))
      languages = d
      addons = 
      ifeq ($(with_libphobos),yes)
        addons += libphobos
      endif
    endif
  endif
  ifneq ($(DEB_CROSS),yes) # no docs for cross compilers
  ifneq ($(GFDL_INVARIANT_FREE),yes)
    addons += gfdldoc
  endif
  endif
endif # not stage

control-file:
	echo "addons: $(addons)"; \
	m4 $(ctrl_flags) \
	  -DPV=$(pkg_ver) \
	  -DCXX_SO=$(CXX_SONAME) \
	  -DGCC_SO=$(GCC_SONAME) \
	  -DOBJC_SO=$(OBJC_SONAME) \
	  -DFORTRAN_SO=$(FORTRAN_SONAME) \
	  -DGCJ_SO=$(PKG_GCJ_EXT) \
	  -DLIBGCJ_EXT=$(PKG_LIBGCJ_EXT) \
	  -DGNAT_SO=$(GNAT_SONAME) \
	  -DGNAT_V=$(GNAT_VERSION) \
	  -DPHOBOS_V=$(libphobos_version) \
	  -DGOMP_SO=$(GOMP_SONAME) \
	  -DGCCMATH_SO=$(GCCMATH_SONAME) \
	  -DITM_SO=$(ITM_SONAME) \
	  -DATOMIC_SO=$(ATOMIC_SONAME) \
	  -DBTRACE_SO=$(BTRACE_SONAME) \
	  -DASAN_SO=$(ASAN_SONAME) \
	  -DTSAN_SO=$(TSAN_SONAME) \
	  -DQMATH_SO=$(QUADMATH_SONAME) \
	  -DSSP_SO=$(SSP_SONAME) \
	  -DGO_SO=$(GO_SONAME) \
	  -Denabled_languages="$(languages) $(addons)" \
	  -Dada_no_archs="$(ada_no_archs)" \
	  -Djava_no_archs="$(java_no_archs)" \
	  -Dfortran_no_archs="$(fortran_no_archs)" \
	  -Dlibgc_no_archs="$(libgc_no_archs)" \
	  -Dlibphobos_archs="$(libphobos_archs)" \
	  -Dlibphobos_no_archs="$(libphobos_no_archs)" \
	  -Dcheck_no_archs="$(check_no_archs)" \
	  -Dlocale_no_archs="$(locale_no_archs)" \
	  -Dlinux_gnu_archs="$(linux_gnu_archs)" \
	  -Dbiarch32_archs="$(strip $(subst /, ,$(biarch32archs)))" \
	  -Dbiarch64_archs="$(strip $(subst /, ,$(biarch64archs)))" \
	  -Dbiarchn32_archs="$(strip $(subst /, ,$(biarchn32archs)))" \
	  -Dbiarchx32_archs="$(strip $(subst /, ,$(biarchx32archs)))" \
	  -Dbiarchhf_archs="$(strip $(subst /, ,$(biarchhfarchs)))" \
	  -Dbiarchsf_archs="$(strip $(subst /, ,$(biarchsfarchs)))" \
	  -Dadd_built_using=$(add_built_using) \
		debian/control.m4 > debian/control.tmp2
	uniq debian/control.tmp2 | sed '/^Build/s/ *, */, /g;/^  /s/ *, */, /g' \
		$(if $(filter yes, $(with_base_only)), | awk '/^$$/ {if (p) exit; else p=1; } {print}') \
		> debian/control.tmp
	rm -f debian/control.tmp2
	[ -e debian/control ] \
	  && cmp -s debian/control debian/control.tmp \
	  && rm -f debian/control.tmp && exit 0; \
	  mv debian/control.tmp debian/control; touch $(control_stamp)

readme-bugs-file:
	m4 -DDIST=$(distribution) -DSRCNAME=$(PKGSOURCE) \
		debian/README.Bugs.m4 > debian/README.Bugs

copyright-file:
	rm -f debian/copyright
	if echo $(SOURCE_VERSION) | grep -E ^'[0-9]\.[0-9]-[0-9]{8}' ; \
		then SVN_BRANCH="trunk" ; \
	else \
		SVN_BRANCH="gcc-$(subst .,_,$(BASE_VERSION))-branch" ; \
	fi ; \
	sed debian/copyright.in		\
		-e "s/@BV@/$(BASE_VERSION)/g"		\
		-e "s/@SVN_BRANCH@/$$SVN_BRANCH/g"	\
		> debian/copyright

substvars-file:
	rm -f debian/substvars.local.tmp
	( \
		echo 'libgcc:Version=$(DEB_LIBGCC_VERSION)'; \
		echo 'gcc:Version=$(DEB_GCC_VERSION)'; \
		echo 'gcc:EpochVersion=$(DEB_EVERSION)'; \
		echo 'gcc:SoftVersion=$(DEB_GCC_SOFT_VERSION)'; \
		echo 'gdc:Version=$(DEB_GDC_VERSION)'; \
		echo 'gcj:Version=$(DEB_GCJ_VERSION)'; \
		echo 'gcj:SoftVersion=$(DEB_GCJ_SOFT_VERSION)'; \
		echo 'gcj:BaseVersion=$(BASE_VERSION)'; \
		echo 'gnat:Version=$(DEB_GNAT_VERSION)'; \
		echo 'binutils:Version=$(BINUTILSV)'; \
		echo 'dep:libgcc=$(LIBGCC_DEP)'; \
		echo 'dep:libgccdev=$(LIBGCC_DEV_DEP)'; \
		echo 'dep:libgccbiarch=$(libgccbiarch)'; \
		echo 'dep:libgccbiarchdev=$(libgccbiarchdev)'; \
		echo 'dep:libc=$(LIBC_DEP) (>= $(libc_ver))'; \
		echo 'dep:libcdev=$(LIBC_DEV_DEP)'; \
		echo 'dep:libcbiarch=$(LIBC_BIARCH_DEP)'; \
		echo 'dep:libcbiarchdev=$(LIBC_BIARCH_DEV_DEP)'; \
		echo 'dep:libunwinddev=$(LIBUNWIND_DEV_DEP)'; \
		echo 'dep:libcxxbiarchdev=$(libstdc++biarchdev)'; \
		echo 'dep:libcxxbiarchdbg=$(libstdc++biarchdbg)'; \
		echo 'dep:libgnat=$(LIBGNAT_DEP)'; \
		echo 'dep:ecj=$(ECJ_DEP)'; \
		echo 'dep:libcloog=$(CLOOG_RUNTIME_DEP)'; \
	) > debian/substvars.local.tmp
ifneq (,$(filter $(DEB_TARGET_ARCH), $(multilib_archs)))
	( \
		echo 'gcc:multilib=gcc-$(BASE_VERSION)-multilib$(TS)'; \
		echo 'gxx:multilib=g++-$(BASE_VERSION)-multilib$(TS)'; \
		echo 'gobjc:multilib=gobjc-$(BASE_VERSION)-multilib$(TS)'; \
		echo 'gobjcxx:multilib=gobjc++-$(BASE_VERSION)-multilib$(TS)'; \
		echo 'gfortran:multilib=gfortran-$(BASE_VERSION)-multilib$(TS)'; \
	) >> debian/substvars.local.tmp
endif
ifeq ($(with_gold),yes)
	echo 'dep:gold=binutils-gold (>= $(BINUTILSV))' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_libssp),yes)
	echo 'dep:libssp=libssp$(SSP_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_gomp),yes)
	echo 'dep:libgomp=libgomp$(GOMP_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_itm),yes)
	echo 'dep:libitm=libitm$(ITM_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_atomic),yes)
	echo 'dep:libatomic=libatomic$(ATOMIC_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_libbacktrace),yes)
	echo 'dep:libbacktrace=libbtrace$(BTRACE_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_asan),yes)
	echo 'dep:libasan=libasan$(ASAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_tsan),yes)
	echo 'dep:libtsan=libtsan$(TSAN_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_qmath),yes)
	echo 'dep:libqmath=libquadmath$(QUADMATH_SONAME)$(LS)$(AQ) (>= $${gcc:Version})' \
		>> debian/substvars.local.tmp
endif
ifeq ($(multilib),yes)
	echo 'dep:libgfortranbiarchdev=$(libgfortranbiarchdev)' \
		>> debian/substvars.local.tmp
	echo 'dep:libobjcbiarchdev=$(libobjcbiarchdev)' \
		>> debian/substvars.local.tmp
  ifeq ($(with_libssp),yes)
	echo 'dep:libsspbiarch=$(libsspbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_gomp),yes)
	echo 'dep:libgompbiarch=$(libgompbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_itm),yes)
	echo 'dep:libitmbiarch=$(libitmbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_atomic),yes)
	echo 'dep:libatomicbiarch=$(libatomicbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_libbacktrace),yes)
	echo 'dep:libbtracebiarch=$(libbtracebiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_asan),yes)
	echo 'dep:libasanbiarch=$(libasanbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_tsan),yes)
	#echo 'dep:libtsanbiarch=$(libtsanbiarch)' \
	#	>> debian/substvars.local.tmp
  endif
  ifeq ($(with_qmath),yes)
	echo 'dep:libqmathbiarch=$(libquadmathbiarch)' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(with_go),yes)
	echo 'dep:libgobiarchdev=$(libgobiarchdev)' \
		>> debian/substvars.local.tmp
	echo 'dep:libgobiarch=$(libgobiarch)' \
		>> debian/substvars.local.tmp
  endif
endif
ifneq ($(with_standalone_gcj),yes)
  ifneq (,$(filter $(DEB_HOST_ARCH),armel armhf))
	echo 'dep:gcj=g++$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
  else
	echo 'dep:gcj=gcc$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
  endif
  ifeq ($(DEB_CROSS),yes)
	echo 'dep:gcjcross=gcj$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
  endif
endif
ifeq ($(DEB_CROSS),yes)
	echo 'dep:gdccross=gdc$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
endif
ifeq ($(with_libphobos),yes)
	echo 'dep:phobosdev=libphobos$(pkg_ver)-dev$(LS)$(AQ) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
  ifeq ($(DEB_CROSS),yes)
	: # FIXME: make the cross gdc aware of both include paths
	echo 'dep:gdccross=gdc$(pkg_ver) (>= $(DEB_GCC_SOFT_VERSION))' \
		>> debian/substvars.local.tmp
  endif
endif
#ifneq (,$(findstring gtk, $(java_awt_peers)))
#	echo 'pkg:gcjgtk=libgcj$(subst 0,,$(GCJ_SONAME))-awt-gtk (>= $(DEB_GCJ_VERSION))' \
#		>> debian/substvars.local.tmp
#endif
#ifneq (,$(findstring qt, $(java_awt_peers)))
#	echo 'pkg:gcjqt=libgcj$(subst 0,,$(GCJ_SONAME))-awt-qt (>= $(DEB_GCJ_VERSION))' \
#		>> debian/substvars.local.tmp
#endif
ifeq ($(DEB_HOST_ARCH),hppa)
	echo 'dep:prctl=prctl' >> debian/substvars.local.tmp
endif
ifeq ($(derivative)-$(DEB_HOST_ARCH),Debian-amd64)
	echo 'confl:lib32=libc6-i386 (<< 2.9-22)' >> debian/substvars.local.tmp
endif
ifeq ($(with_multiarch_lib),yes)
	echo 'multiarch:breaks=gcc-4.1, gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<< 4.4.6-4), gcc-4.5 (<< 4.5.3-2)' >> debian/substvars.local.tmp
endif
ifeq ($(add_built_using),yes)
	echo "Built-Using=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W gcc$(pkg_ver)-source)" \
	>> debian/substvars.local.tmp
endif
	v=`sed -n '/^#define MOD_VERSION/s/.* "\([0-9]*\)"/\1/p' \
		$(srcdir)/gcc/fortran/module.c`; \
	echo "fortran:mod-version=gfortran-mod-$$v" >> debian/substvars.local.tmp

	[ -e debian/substvars.local ] \
	  && cmp -s debian/substvars.local debian/substvars.local.tmp \
	  && rm -f debian/substvars.local.tmp && exit 0; \
	  mv debian/substvars.local.tmp debian/substvars.local; \
	  touch $(control_stamp)

parameters-file:
	rm -f debian/rules.parameters.tmp
	( \
		echo '# configuration parameters taken from upstream source files'; \
		echo 'GCC_VERSION	:= $(GCC_VERSION)'; \
		echo 'NEXT_GCC_VERSION	:= $(NEXT_GCC_VERSION)'; \
		echo 'BASE_VERSION	:= $(BASE_VERSION)'; \
		echo 'SOURCE_VERSION	:= $(SOURCE_VERSION)'; \
		echo 'DEB_VERSION	:= $(DEB_VERSION)'; \
		echo 'DEB_EVERSION	:= $(DEB_EVERSION)'; \
		echo 'DEB_GDC_VERSION	:= $(DEB_GDC_VERSION)'; \
		echo 'DEB_SOVERSION	:= $(DEB_SOVERSION)'; \
		echo 'DEB_SOEVERSION	:= $(DEB_SOEVERSION)'; \
		echo 'DEB_LIBGCC_SOVERSION	:= $(DEB_LIBGCC_SOVERSION)'; \
		echo 'DEB_LIBGCC_VERSION	:= $(DEB_LIBGCC_VERSION)'; \
		echo 'DEB_STDCXX_SOVERSION	:= $(DEB_STDCXX_SOVERSION)'; \
		echo 'DEB_GCJ_SOVERSION	:= $(DEB_GCJ_SOVERSION)'; \
		echo 'PKG_GCJ_EXT	:= $(PKG_GCJ_EXT)'; \
		echo 'PKG_LIBGCJ_EXT	:= $(PKG_LIBGCJ_EXT)'; \
		echo 'DEB_GOMP_SOVERSION	:= $(DEB_GOMP_SOVERSION)'; \
		echo 'DEB_GCCMATH_SOVERSION	:= $(DEB_GCCMATH_SOVERSION)'; \
		echo 'GCC_SONAME	:= $(GCC_SONAME)'; \
		echo 'CXX_SONAME	:= $(CXX_SONAME)'; \
		echo 'FORTRAN_SONAME	:= $(FORTRAN_SONAME)'; \
		echo 'OBJC_SONAME	:= $(OBJC_SONAME)'; \
		echo 'GCJ_SONAME	:= $(GCJ_SONAME)'; \
		echo 'GDC_VERSION	:= $(GDC_VERSION)'; \
		echo 'GNAT_VERSION	:= $(GNAT_VERSION)'; \
		echo 'GNAT_SONAME	:= $(GNAT_SONAME)'; \
		echo 'FFI_SONAME	:= $(FFI_SONAME)'; \
		echo 'SSP_SONAME	:= $(SSP_SONAME)'; \
		echo 'GOMP_SONAME	:= $(GOMP_SONAME)'; \
		echo 'ITM_SONAME	:= $(ITM_SONAME)'; \
		echo 'ATOMIC_SONAME	:= $(ATOMIC_SONAME)'; \
		echo 'BTRACE_SONAME	:= $(BTRACE_SONAME)'; \
		echo 'ASAN_SONAME	:= $(ASAN_SONAME)'; \
		echo 'TSAN_SONAME	:= $(TSAN_SONAME)'; \
		echo 'QMATH_SONAME	:= $(QUADMATH_SONAME)'; \
		echo 'GCCMATH_SONAME	:= $(GCCMATH_SONAME)'; \
		echo 'GO_SONAME		:= $(GO_SONAME)'; \
		echo 'LIBC_DEP		:= $(LIBC_DEP)'; \
	) > debian/rules.parameters.tmp
	[ -e debian/rules.parameters ] \
	  && cmp -s debian/rules.parameters debian/rules.parameters.tmp \
	  && rm -f debian/rules.parameters.tmp && exit 0; \
	  mv debian/rules.parameters.tmp debian/rules.parameters; \
	  touch $(control_stamp)

symbols-files:
ifeq ($(DEB_CROSS),yes)
  ifneq ($(with_deps_on_target_arch_pkgs),yes)
	for f in debian/*.symbols; do \
	  [ -f "$$f" ] || continue; \
	  [ -L "$$f" ] && continue; \
	  b=$$(basename $$f .symbols); \
	  ln -sf $$f debian/$$b$(LS).symbols; \
	done
	for f in debian/*.symbols.$(DEB_TARGET_ARCH); do \
	  [ -f "$$f" ] || continue; \
	  [ -L "$$f" ] && continue; \
	  b=$$(basename $$f .symbols.$(DEB_TARGET_ARCH)); \
	  ln -sf $$f debian/$$b$(LS).symbols; \
	done
  endif
endif

versioned-files:
	fs=`echo debian/*BV* debian/*GCJ* debian/*CXX* debian/*LC* | sort -u`; \
	for f in $$fs debian/source.lintian-overrides.in; do \
	  [ -f $$f ] || echo "CANNOT FIND $$f"; \
	  [ -f $$f ] || continue; \
	  if [ -z "$(DEB_CROSS)" ]; then case "$$f" in *-CR*) continue; esac; fi; \
	  f2=$$(echo $$f \
		| 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$$//'); \
	  sed -e 's/@BV@/$(BASE_VERSION)/g' \
	      -e 's/@CXX@/$(CXX_SONAME)/g' \
	      -e 's/@LGCJ@/$(PKG_LIBGCJ_EXT)/g' \
	      -e 's/@GCJ@/$(PKG_GCJ_EXT)/g' \
	      -e 's/@GCJSO@/$(GCJ_SONAME)/g' \
	      -e 's/@LC@/$(GCC_SONAME)/g' \
	      -e 's/@SRC@/$(PKGSOURCE)/g' \
	      -e 's/@GFDL@/$(if $(filter yes,$(GFDL_INVARIANT_FREE)),#)/g' \
	      -e 's/@java_priority@/$(java_priority)/g' \
	      -e 's/@gcc_priority@/$(subst .,,$(BASE_VERSION))/g' \
	      -e 's/@TARGET@/$(DEB_TARGET_GNU_TYPE)/g' \
	      -e 's/@TARGET_QUAL@/$(TARGET_QUAL)/g' \
	    $$f > $$f2; \
	  touch -r $$f $$f2; \
	done
	for t in ar nm ranlib; do \
	  sed "s/@BV@/$(BASE_VERSION)/g;s/@TOOL@/$$t/g" \
	    debian/gcc-XX-BV.1 > debian/gcc-$$t-$(BASE_VERSION).1; \
	done

# don't encode versioned build dependencies in the control file, but check
# these here instead.
check-versions:
	v=$$(dpkg-query -l dpkg-dev | awk '/^.i/ {print $$3}'); \
	if dpkg --compare-versions "$$v" lt "$(DPKGV)"; then \
	  echo "dpkg-dev (>= $(DPKGV)) required, found $$v"; \
	  exit 1; \
	fi
	v=$$(dpkg-query -l binutils binutils-multiarch | awk '/^.i/ {print $$3;exit}'); \
	if dpkg --compare-versions "$$v" lt "$(BINUTILSBDV)"; then \
	  echo "binutils (>= $(BINUTILSBDV)) required, found $$v"; \
	  exit 1; \
	fi