2 # debian/rules file - for binutils (2.20)
3 # Based on sample debian/rules file - for GNU Hello (1.3).
4 # Copyright 1994,1995 by Ian Jackson.
5 # Copyright 1998-2007 James Troup.
6 # Portions Copyright 2008-2009 Canonical Ltd.
7 # Portions Copyright 2008-2009 Matthias Klose.
8 # I hereby give you perpetual unlimited permission to copy,
9 # modify and relicense this file, provided that you do not remove
10 # my name from the file itself. (I assert my moral right of
11 # paternity under the Copyright, Designs and Patents Act 1988.)
12 # This file may have to be extensively modified
14 ################################################################################
18 p_mul = $(p_bin)-multiarch
19 p_gold = $(p_bin)-gold
21 p_hppa64 = $(p_bin)-hppa64
23 p_src = $(p_bin)-source
25 # BACKPORT is used for cross builds for a -source package not conflicting
26 # with the source package of the native package.
27 ifeq ($(BACKPORT),true)
28 p_src = $(p_bin)-$(VERSION)-source
30 p_src = $(p_bin)-source
36 d_dev = debian/$(p_dev)
37 d_mul = debian/$(p_mul)
38 d_gold = debian/$(p_gold)
39 d_doc = debian/$(p_doc)
40 d_hppa64 = debian/$(p_hppa64)
41 d_spu = debian/$(p_spu)
42 d_src = debian/$(p_src)
44 install_dir = install -d -m 755
45 install_file = install -m 644
46 install_script = install -m 755
47 install_binary = install -m 755 -s
49 vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
50 DPKG_VARS := $(shell dpkg-architecture)
51 DEB_BUILD_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE)
52 DEB_HOST_ARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
53 DEB_HOST_GNU_TYPE ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)
54 DEB_HOST_MULTIARCH ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
56 ifeq (,$(DEB_HOST_MULTIARCH))
57 ifeq ($(DEB_HOST_ARCH),i386)
58 DEB_HOST_MULTIARCH = i386-linux-gnu
60 DEB_HOST_MULTIARCH = $(DEB_HOST_GNU_TYPE)
66 ifneq (,$(filter $(DEB_HOST_ARCH), amd64 armel armhf i386 powerpc powerpcspe ppc64 sparc sparc64))
75 STRIP = strip --remove-section=.comment --remove-section=.note
77 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
78 CROSS := $(DEB_HOST_GNU_TYPE)-
81 STRIP= $(CROSS)strip --remove-section=.comment --remove-section=.note
82 install_binary = install -m 755 -s --strip-program="$(STRIP)"
85 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
89 # this outputs 0 or 1 depending on whether a macro appears in the *default* cpp
90 # -dM -P output; this is used to test the toolchain *default* configuration
91 check_cpp = $(shell $(CROSS)cpp -dM -P /dev/null | grep -q '^\#define $(1)' && echo 1 || echo 0)
93 # testsuite doesn't expect to be built with -mthumb
94 # TODO if the testsuite is only broken with Thumb-2 (and not with "Thumb-1"),
95 # we should test for __thumb2__ instead
96 ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf))
97 ifeq ($(call check_cpp,__thumb__),1)
102 # see LP: #446478, would only fix the testcases
103 #ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf))
104 # CFLAGS += -fno-section-anchors
107 SPACE = $(EMPTY) $(EMPTY)
109 CHANGELOG_VARS := $(shell dpkg-parsechangelog | \
110 sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p')
112 DEB_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version)
113 DEB_SVERSION := $(shell echo $(DEB_VERSION) | sed 's/+b[0-9][0-9]*$$//')
114 DEB_UPSTREAM := $(firstword $(subst -,$(SPACE),$(DEB_VERSION)))
116 VERSION := $(shell sed -n 's/^ *VERSION=\(.*\)/\1/p' bfd/configure | head -1)
117 DATE := $(shell sed -n 's/.* \([0-9]*\)$$/\1/p' bfd/version.h)
122 ifneq ($(DEB_UPSTREAM),$(VERSION)$(DATE_EXT))
123 $(error upstream ($(DEB_UPSTREAM)) and debian ($(VERSION)$(DATE_EXT)) version mismatch)
126 SINGLE_VERSION= $(VERSION)-system
127 MULTI_VERSION = $(VERSION)-multiarch
128 HPPA64_VERSION= $(VERSION)-hppa64
129 SPU_VERSION = $(VERSION)-spu
133 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
134 ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
135 NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
137 ifneq (,$(findstring nogold,$(DEB_BUILD_OPTIONS)))
138 with_gold = disabled in DEB_BUILD_OPTIONS
140 ifneq (,$(findstring nomult,$(DEB_BUILD_OPTIONS)))
141 with_multiarch = disabled in DEB_BUILD_OPTIONS
144 # If $(TARGET) is not set, try reading debian/target
146 ifneq (,$(wildcard debian/target))
147 TARGET := $(shell cat debian/target 2>/dev/null)
151 # PF is the installation prefix for the package without the leading slash.
152 # It's "usr" for gcc releases, so use this if not explicitly set
157 ########################################
163 --build=$(DEB_BUILD_GNU_TYPE) \
164 --host=$(DEB_HOST_GNU_TYPE) \
165 --with-pkgversion="GNU Binutils for $(DISTRIBUTION)"
167 ifeq ($(DEB_HOST_MULTIARCH),x86_64-linux-gnu)
168 DEB_HOST_MULTIARCH32 = i386-linux-gnu
169 else ifeq ($(DEB_HOST_MULTIARCH),powerpc64-linux-gnu)
170 DEB_HOST_MULTIARCH32 = powerpc-linux-gnu
171 else ifeq ($(DEB_HOST_MULTIARCH),s390x-linux-gnu)
172 DEB_HOST_MULTIARCH32 = s390-linux-gnu
173 else ifeq ($(DEB_HOST_MULTIARCH),sparc64-linux-gnu)
174 DEB_HOST_MULTIARCH32 = sparc-linux-gnu
175 else ifeq ($(DEB_HOST_MULTIARCH),x86_64-kfreebsd-gnu)
176 DEB_HOST_MULTIARCH32 = i386-kfreebsd-gnu
177 else ifeq ($(DEB_HOST_MULTIARCH),i386-linux-gnu)
178 DEB_HOST_MULTIARCH64 = x86_64-linux-gnu
179 else ifeq ($(DEB_HOST_MULTIARCH),powerpc-linux-gnu)
180 DEB_HOST_MULTIARCH64 = powerpc64-linux-gnu
181 else ifeq ($(DEB_HOST_MULTIARCH),sparc-linux-gnu)
182 DEB_HOST_MULTIARCH64 = sparc64-linux-gnu
183 else ifeq ($(DEB_HOST_MULTIARCH),s390-linux-gnu)
184 DEB_HOST_MULTIARCH64 = s390x-linux-gnu
185 else ifeq ($(DEB_HOST_MULTIARCH),i386-kfreebsd-gnu)
186 DEB_HOST_MULTIARCH64 = x86_64-linux-gnu
187 else ifeq ($(DEB_HOST_MULTIARCH),mips-linux-gnu)
188 DEB_HOST_MULTIARCH64 = mips64-linux-gnu
189 else ifeq ($(DEB_HOST_MULTIARCH),mipsel-linux-gnu)
190 DEB_HOST_MULTIARCH64 = mips64el-linux-gnu
192 export DEB_HOST_MULTIARCH DEB_HOST_MULTIARCH32 DEB_HOST_MULTIARCH64
194 ifeq ($(DEB_HOST_ARCH),sparc)
195 CONFARGS += --enable-targets=sparc64-linux-gnu
196 CONFLICTS = -VextraConflicts="libc6-dev-sparc64 (<< 2.2.5-7)"
198 ifeq ($(DEB_HOST_ARCH),sparc64)
199 CONFARGS += --enable-targets=sparc-linux-gnu
200 CONFLICTS = -VextraConflicts="libc6-dev-sparc64 (<< 2.2.5-7)"
202 ifeq ($(DEB_HOST_ARCH),powerpc)
203 CONFARGS += --enable-targets=powerpc64-linux-gnu,spu
205 ifeq ($(DEB_HOST_ARCH),ppc64)
206 CONFARGS += --enable-targets=powerpc-linux-gnu,spu
208 ifeq ($(DEB_HOST_ARCH),s390)
209 CONFARGS += --enable-targets=s390x-linux-gnu
211 ifeq ($(DEB_HOST_ARCH),i386)
212 CONFARGS += --enable-targets=x86_64-linux-gnu
214 ifeq ($(DEB_HOST_ARCH),kfreebsd-i386)
215 CONFARGS += --enable-targets=x86_64-kfreebsd-gnu
217 ifeq ($(DEB_HOST_ARCH),mips)
218 CONFARGS += --enable-targets=mips64-linux-gnu
220 ifeq ($(DEB_HOST_ARCH),mipsel)
221 CONFARGS += --enable-targets=mips64el-linux-gnu
223 ifneq (,$(filter $(DEB_HOST_ARCH),armhf ia64 sparc sparc64))
224 CONFARGS += --disable-werror
227 ifneq ($(DISTRIBUTION),SLP)
230 with_check := disabled for SLP
233 ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
234 with_check := disabled through DEB_BUILD_OPTIONS
236 ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf mips mipsel sparc))
237 ignore_regressions := regressions ignored on architecture $(DEB_HOST_ARCH)
239 ignore_regressions := regressions ignored on architecture $(DEB_HOST_ARCH)
240 #ifneq (,$(filter $(DEB_HOST_ARCH),mips mipsel))
241 # with_check := disabled for architecture $(DEB_HOST_ARCH)
245 ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
246 with_strip := disabled through DEB_BUILD_OPTIONS
249 source_files = $(addprefix $(shell basename $(pwd))/, \
250 $(filter-out %-stamp .pc CVS debian builddir-% test-summary, $(wildcard *)))
252 ################################################################################
260 ifneq ($(PATCHED_SOURCES),yes)
261 QUILT_PATCHES=$(CURDIR)/debian/patches \
262 quilt --quiltrc /dev/null push -a || test $$? = 2
266 patch-cross: patch-cross-stamp
268 patch -p1 <debian/patches/xx_force_non-native.patch
272 if [ -f patch-cross-stamp ]; \
274 patch -R -p1 <debian/patches/xx_force_non-native.patch; \
276 rm -f patch-cross-stamp
278 unpatch: unpatch-cross
279 QUILT_PATCHES=$(CURDIR)/debian/patches \
280 quilt --quiltrc /dev/null pop -a -R || test $$? = 2
284 export QUILT_PATCHES=$(CURDIR)/debian/patches; \
285 export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
286 export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
287 while quilt push; do quilt refresh; done
289 ################################################################################
297 -rm -fr builddir-multi builddir-single builddir-hppa64 builddir-spu builddir-gold
298 -find . -name \*.gmo -o -name \*~ -o -name \*.info ! -name sysroff.info | xargs rm -f
299 -rm -f $(pwd)/test-summary*
300 -rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_doc) $(d_hppa64) $(d_src) $(d_spu) $(d_gold)
301 -rm -rf debian/patched debian/tmp debian/files* debian/substvars
302 -rm -f debian/*.orig debian/*.rej
303 -rm -rf $(d_cross) debian/files debian/substvars
304 -rm -rf builddir-$(TARGET) {configure,build,install}-cross-stamp
305 for i in debian/*.in; do \
306 case "$$i" in debian/control*.in) continue; esac; \
312 ################################################################################
314 #######################
315 # single-arch targets #
316 #######################
318 SINGLE_CONFARGS = $(CONFARGS)
319 ifeq ($(with_gold),yes)
320 SINGLE_CONFARGS += --enable-ld=default --enable-gold
323 configure-single-stamp: patch-stamp
326 ifeq ($(with_check),yes)
327 @if echo "spawn true" | /usr/bin/expect -f - >/dev/null; then \
330 echo "expect is failing on your system with the above error, which means the"; \
331 echo "testsuite will fail. Please resolve the above issues and retry the build."; \
332 echo "-----------------------------------------------------------------------------"; \
337 rm -rf configure-single-stamp \
339 mkdir builddir-single
340 cd builddir-single && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" \
341 ../configure --with-sysroot=/ $(SINGLE_CONFARGS)
342 $(MAKE) -C builddir-single configure-host
343 touch configure-single-stamp
345 build-single-stamp: configure-single-stamp
347 env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \
348 $(MAKE) -C builddir-single/bfd headers
349 env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \
350 $(MAKE) $(NJOBS) -C builddir-single
351 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
352 ifeq ($(with_check),yes)
353 -env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \
354 $(MAKE) -C builddir-single -k check
355 cat builddir-single/binutils/binutils.sum \
356 builddir-single/gas/testsuite/gas.sum \
357 builddir-single/ld/ld.sum >> $(pwd)/test-summary
359 if [ ! -f /usr/share/doc/binutils/test-summary.gz ]; then \
360 echo "No test results available for the installed binutils version"; \
361 elif [ -x /usr/bin/python ]; then \
362 echo "Test results, compared with installed binutils:"; \
363 zcat /usr/share/doc/binutils/test-summary.gz > test-summary-installed; \
364 if python debian/test-suite-compare.py test-summary-installed test-summary; then \
366 elif [ -n "$(ignore_regressions)" ]; then \
367 echo "$(ignore_regressions)"; \
372 echo "python not installed, not comparing test results."; \
376 touch build-single-stamp
379 ################################################################################
381 #####################
382 # multiarch targets #
383 #####################
385 multiarch_targets = \
398 powerpc64-linux-gnu \
409 configure-multi-stamp: patch-stamp
411 rm -rf configure-multi-stamp \
415 && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" ../configure $(CONFARGS) \
418 --enable-targets=$(subst $(SPACE),$(COMMA),$(multiarch_targets))
419 $(MAKE) -C builddir-multi configure-host
420 touch configure-multi-stamp
422 build-multi-stamp: configure-multi-stamp
424 $(MAKE) -C builddir-multi/bfd headers
425 env MAKE="$(MAKE) VERSION=$(MULTI_VERSION)" \
426 $(MAKE) $(NJOBS) -C builddir-multi
427 touch build-multi-stamp
429 ################################################################################
435 configure-static-stamp: patch-stamp
437 rm -rf configure-static-stamp \
439 mkdir builddir-static
441 && env CC="$(CC)" CXX="$(CXX)" CFLAGS="-g0 -Os" ../configure \
443 --build=$(DEB_BUILD_GNU_TYPE) \
444 --host=$(DEB_HOST_GNU_TYPE) \
445 --with-pkgversion="GNU Binutils for $(DISTRIBUTION)"
446 $(MAKE) -C builddir-static configure-bfd
447 $(MAKE) -C builddir-static configure-ld
448 touch configure-static-stamp
450 build-static-stamp: configure-static-stamp
452 $(MAKE) $(NJOBS) -C builddir-static/libiberty CCLD='$(CC) -all-static'
453 $(MAKE) $(NJOBS) -C builddir-static/bfd CCLD='$(CC) -all-static'
454 $(MAKE) $(NJOBS) -C builddir-static/ld CCLD='$(CC) -all-static'
455 touch build-static-stamp
457 ################################################################################
463 configure-hppa64-stamp: patch-stamp
465 rm -rf configure-hppa64-stamp \
467 mkdir builddir-hppa64
469 && env CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" ../configure \
472 --build=$(DEB_BUILD_GNU_TYPE) \
473 --host=$(DEB_HOST_GNU_TYPE) \
474 --target=hppa64-linux-gnu
475 $(MAKE) -C builddir-hppa64 configure-host
476 touch configure-hppa64-stamp
478 build-hppa64-stamp: configure-hppa64-stamp
480 $(MAKE) -C builddir-hppa64/bfd headers
481 env MAKE="$(MAKE) VERSION=$(HPPA64_VERSION)" \
482 $(MAKE) $(NJOBS) -C builddir-hppa64
483 touch build-hppa64-stamp
485 ################################################################################
491 configure-spu-stamp: patch-stamp
493 rm -rf configure-spu-stamp \
497 && env CC="$(CC)" CFLAGS="$(CFLAGS)" ../configure \
500 --program-prefix=spu- \
501 --build=$(DEB_BUILD_GNU_TYPE) \
502 --host=$(DEB_BUILD_GNU_TYPE) \
504 $(MAKE) -C builddir-spu configure-host
505 touch configure-spu-stamp
507 build-spu-stamp: configure-spu-stamp
509 $(MAKE) -C builddir-spu/bfd headers
510 env MAKE="$(MAKE) VERSION=$(SPU_VERSION)" \
511 $(MAKE) $(NJOBS) -C builddir-spu
512 touch build-spu-stamp
514 ################################################################################
517 #ifneq (,$(filter $(DEB_HOST_ARCH), armel powerpc))
520 # @echo Explicitely fail the build for architecture $(DEB_HOST_ARCH)
524 build_stamps = build-single-stamp
525 ifeq ($(with_multiarch),yes)
526 build_stamps += build-multi-stamp
528 ifeq ($(DEB_HOST_ARCH),hppa)
529 build_stamps += build-hppa64-stamp
531 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
532 build_stamps += build-spu-stamp
535 ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS)))
536 build_stamps = build-static-cross-stamp
538 build_stamps = build-cross-stamp
542 ifeq ($(BACKPORT),true)
547 build: pre-build build-stamp
548 build-stamp: $(build_stamps)
551 ################################################################################
557 install_stamps = install-stamp
558 ifeq ($(DEB_HOST_ARCH),hppa)
559 install_stamps += install-hppa64-stamp
561 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
562 install_stamps += install-spu-stamp
565 ifneq (,$(findstring static-cross,$(DEB_BUILD_OPTIONS)))
566 install_stamps = install-static-cross-stamp
568 install_stamps = install-cross-stamp
571 ifeq ($(BACKPORT),true)
574 install: $(install_stamps)
575 install-stamp: checkroot build-stamp
578 rm -fr $(d_bin) $(d_dev) $(d_mul) $(d_doc) $(d_src)
579 $(install_dir) $(d_bin) $(d_dev) $(d_mul) $(d_doc) $(d_src)
581 : # install binutils and -dev stuff
582 env MAKE="$(MAKE) VERSION=$(SINGLE_VERSION)" \
583 $(MAKE) -C builddir-single \
584 CFLAGS="$(CFLAGS)" prefix=$(pwd)/$(d_bin)/$(PF) \
585 mandir=$(pwd)/$(d_bin)/$(PF)/share/man \
586 infodir=$(pwd)/$(d_doc)/$(PF)/share/info install
588 ifeq ($(with_multiarch),yes)
589 : # now install binutils-multiarch stuff
590 env MAKE="$(MAKE) VERSION=$(MULTI_VERSION)" \
591 $(MAKE) -C builddir-multi \
593 prefix=$(pwd)/$(d_mul)/$(PF) \
594 mandir=$(pwd)/$(d_mul)/$(PF)/share/man \
595 infodir=$(pwd)/$(d_doc)/$(PF)/share/info install
598 : # copy libiberty.h ... not too keen on this, but it was requested
599 cp -f include/libiberty.h $(d_bin)/$(PF)/include
601 : # copy demangle.h ... not too keen on this, but it was requested
602 cp -f include/demangle.h $(d_bin)/$(PF)/include
604 : # copy plugin-api.h ...
605 cp -f include/plugin-api.h $(d_bin)/$(PF)/include
607 : # We don't need to distribute everything in binutils and -dev
608 rm -rf $(d_bin)/$(PF)/include/obstack.h
609 rm -f $(d_bin)/$(PF)/man/man1/configure.1
610 rm -f $(d_doc)/$(PF)/share/info/configure.* $(d_doc)/$(PF)/share/info/standards.*
611 : # *sigh*, bugs.debian.org/213524
612 rm -f $(d_doc)/$(PF)/share/info/dir*
614 ifeq ($(with_multiarch),yes)
615 : # Now get rid of just about everything in binutils-multiarch
616 rm -rf $(d_mul)/$(PF)/man $(d_mul)/$(PF)/info $(d_mul)/$(PF)/include
617 rm -rf $(d_mul)/$(PF)/share/man $(d_mul)/$(PF)/share/info $(d_mul)/$(PF)/share/locale
619 : # elfedit (even with its --input-mach option)
620 : # is the same for all targets.
621 rm -f $(d_mul)/$(PF)/bin/elfedit
623 : # c++filt does not link to libbfd for anything more than
624 : # the help message, and its behavior does not vary
625 : # between arches aside from the --version message.
626 rm -f $(d_mul)/$(PF)/bin/c++filt
628 : # As gas/README points out (search for --enable-targets),
629 : # multi-arch gas is not ready yet.
630 rm -f $(d_mul)/$(PF)/bin/as
631 rm -f $(d_mul)/$(PF)/bin/ld
632 rm -f $(d_mul)/$(PF)/bin/ld.bfd
633 rm -f $(d_mul)/$(PF)/bin/ld.gold
634 rm -fr $(d_mul)/$(PF)/lib/ldscripts
636 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
637 rm -f $(d_mul)/$(PF)/bin/embedspu
641 $(install_dir) $(d_dev)/$(PF)/include/ $(d_dev)/$(PF)/lib/
642 mv $(d_bin)/$(PF)/include/* $(d_dev)/$(PF)/include/
643 mv $(d_bin)/$(PF)/lib/*.a $(d_bin)/$(PF)/lib/libbfd.so $(d_bin)/$(PF)/lib/libopcodes.so \
646 ifeq ($(with_multiarch),yes)
647 rm -f $(d_mul)/$(PF)/lib/libbfd.so $(d_mul)/$(PF)/lib/libopcodes.so
648 rm -f $(d_mul)/$(PF)/lib/*.la $(d_mul)/$(PF)/lib/*.a
649 rm -f $(d_mul)/$(PF)/lib*/libiberty*
652 : # Get rid of .la files since libtool obviously has no idea about transient paths
653 rm -f $(d_bin)/$(PF)/lib/*.la
655 ifeq ($(with_strip),yes)
656 : # Strip shared libraries
657 $(STRIP) --strip-unneeded $(d_bin)/$(PF)/lib/libbfd-*so
658 $(STRIP) --strip-unneeded $(d_bin)/$(PF)/lib/libopcodes-*so
660 chmod ugo-x $(d_bin)/$(PF)/lib/*.so
662 $(STRIP) $$(file $(d_bin)/$(PF)/bin/* |awk -F: '$$0 !~ /script/ {print $$1}')
664 ifeq ($(with_multiarch),yes)
665 $(STRIP) --strip-unneeded $(d_mul)/$(PF)/lib/libbfd-*so
666 $(STRIP) --strip-unneeded $(d_mul)/$(PF)/lib/libopcodes-*so
668 chmod ugo-x $(d_mul)/$(PF)/lib/*.so
670 $(STRIP) $$(file $(d_mul)/$(PF)/bin/* |awk -F: '$$0 !~ /script/ {print $$1}')
674 : # Don't want /usr/<arch>-linux to exist in any package
675 rm -rf $(d_bin)/$(PF)/$(DEB_HOST_GNU_TYPE)
677 : # Remove windres manpages
678 rm -f $(d_bin)/$(PF)/share/man/man1/windres.1
680 ifeq ($(with_multiarch),yes)
681 rm -rf $(d_mul)/$(PF)/$(DEB_HOST_GNU_TYPE)
682 rm -f $(d_mul)/$(PF)/share/man/man1/windres.1
685 rm -f $(d_bin)/$(PF)/bin/ld
686 ln -s ld.bfd $(d_bin)/$(PF)/bin/ld
687 ifeq ($(with_gold),yes)
688 ln -s ld.gold $(d_bin)/$(PF)/bin/gold
689 mv $(d_bin)/$(PF)/share/man/man1/ld.1 \
690 $(d_bin)/$(PF)/share/man/man1/ld.bfd.1
691 ln -s ld.bfd.1.gz $(d_bin)/$(PF)/share/man/man1/ld.1.gz
692 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
693 if which help2man >/dev/null 2>&1; then \
694 help2man $(d_bin)/$(PF)/bin/ld.gold > debian/ld.gold.1; \
697 cp debian/ld.gold.1 $(d_bin)/$(PF)/share/man/man1/
698 ln -s ld.gold.1.gz $(d_bin)/$(PF)/share/man/man1/gold.1.gz
700 : # install a symlink for the gold linker
701 $(install_dir) $(d_bin)/$(PF)/lib/gold-ld
702 ln -s ../../bin/ld.gold $(d_bin)/$(PF)/lib/gold-ld/ld
704 : # only keep the gold linker diversion to it's own package.
706 $(install_dir) $(d_gold)
707 $(install_dir) $(d_gold)/$(PF)/bin
708 $(install_dir) $(d_gold)/$(PF)/share/man/man1
709 ln -s ld.gold $(d_gold)/$(PF)/bin/ld
710 ln -s ld.gold.1.gz $(d_gold)/$(PF)/share/man/man1/ld.1.gz
712 : # install a symlink for the old linker
713 $(install_dir) $(d_bin)/$(PF)/lib/compat-ld
714 ln -s ../../bin/ld.bfd $(d_bin)/$(PF)/lib/compat-ld/ld
716 : # Remove empty directory
717 rmdir $(d_bin)/$(PF)/include/
719 : # install libiberty PIC library
720 $(install_file) builddir-single/libiberty/pic/libiberty.a \
721 $(d_dev)/$(PF)/lib/libiberty_pic.a
725 install-hppa64-stamp: checkroot build-hppa64-stamp
729 $(install_dir) $(d_hppa64)
730 $(install_dir) $(d_hppa64)/$(PF)/lib
732 : # install binutils-hppa64 stuff
733 env MAKE="$(MAKE) VERSION=$(HPPA64_VERSION)" \
734 $(MAKE) -C builddir-hppa64 \
736 prefix=$(pwd)/$(d_hppa64)/$(PF)/ \
737 mandir=$(pwd)/$(d_hppa64)/$(PF)/share/man \
738 infodir=$(pwd)/$(d_hppa64)/$(PF)/share/info install
740 : # move shared libs to the standard path
741 mv $(d_hppa64)/$(PF)/$(DEB_HOST_GNU_TYPE)/hppa64-linux-gnu/lib/lib*-*.so \
742 $(d_hppa64)/$(PF)/lib/.
744 : # Now get rid of just about everything in binutils-hppa64
745 rm -rf $(d_hppa64)/$(PF)/man
746 rm -rf $(d_hppa64)/$(PF)/info
747 rm -rf $(d_hppa64)/$(PF)/include
748 rm -rf $(d_hppa64)/$(PF)/share
749 rm -rf $(d_hppa64)/$(PF)/hppa-linux-gnu
750 rm -rf $(d_hppa64)/$(PF)/lib/libiberty.a
752 ifeq ($(with_strip),yes)
753 : # Strip shared libraries
754 $(STRIP) --strip-unneeded $(d_hppa64)/$(PF)/lib/libbfd-*so
755 $(STRIP) --strip-unneeded $(d_hppa64)/$(PF)/lib/libopcodes-*so
756 $(STRIP) $$(file $(d_hppa64)/$(PF)/bin/* | awk -F: '$$0 !~ /script/ {print $$1}')
759 chmod ugo-x $(d_hppa64)/$(PF)/lib/*.so
761 : # Don't want /usr/<arch>-linux to exist in any package
762 rm -rf $(d_hppa64)/$(PF)/hppa64-linux-gnu
764 touch install-hppa64-stamp
766 install-static-stamp: checkroot build-static-stamp
769 rm -fr $(d_static) $(d_udeb)
770 $(install_dir) $(d_static) $(d_udeb)
772 : # Copy static ld-new into /bin for both -static and -static-udeb
773 $(install_dir) $(d_static)/bin
774 $(install_binary) builddir-static/ld/ld-new $(d_static)/bin/ld_static
775 $(install_dir) $(d_udeb)/bin
776 $(install_binary) builddir-static/ld/ld-new $(d_udeb)/bin/ld_static
777 ifeq ($(with_strip),yes)
778 pkg_create_dbgsym $(p_static) $(d_static) || true
779 $(STRIP) --strip-unneeded $(d_static)/bin/ld_static $(d_udeb)/bin/ld_static
782 touch install-static-stamp
784 install-spu-stamp: checkroot build-spu-stamp
788 $(install_dir) $(d_spu)
789 $(install_dir) $(d_spu)/$(PF)/lib
791 : # install binutils-spu stuff
792 env MAKE="$(MAKE) VERSION=$(SPU_VERSION)" \
793 $(MAKE) -C builddir-spu \
795 prefix=$(pwd)/$(d_spu)/$(PF)/ \
796 mandir=$(pwd)/$(d_spu)/$(PF)/share/man \
797 infodir=$(pwd)/$(d_spu)/$(PF)/share/info install
799 : # move shared libs to the standard path
800 mv $(d_spu)/$(PF)/$(DEB_HOST_GNU_TYPE)/spu-elf/lib/lib*-*.so \
803 : # Now get rid of just about everything in binutils-spu
804 rm -rf $(d_spu)/$(PF)/man
805 rm -rf $(d_spu)/$(PF)/info
806 rm -rf $(d_spu)/$(PF)/include
807 rm -rf $(d_spu)/$(PF)/share
808 rm -rf $(d_spu)/$(PF)/$(DEB_HOST_GNU_TYPE)
809 rm -rf $(d_spu)/$(PF)/lib/libiberty.a
810 rm -rf $(d_spu)/$(PF)/lib/ldscripts
812 ifeq ($(with_strip),yes)
813 : # Strip shared libraries
814 $(STRIP) --strip-unneeded $(d_spu)/$(PF)/lib/libbfd-*so
815 $(STRIP) --strip-unneeded $(d_spu)/$(PF)/lib/libopcodes-*so
816 $(STRIP) $$(file $(d_spu)/$(PF)/bin/* | awk -F: '$$0 !~ /script/ {print $$1}')
819 chmod ugo-x $(d_spu)/$(PF)/lib/*.so
821 : # Don't want /usr/<arch>-linux to exist in any package
822 rm -rf $(d_spu)/$(PF)/spu-elf
824 touch install-spu-stamp
826 ################################################################################
828 #######################
829 # binary-indep target #
830 #######################
832 binary-indep: checkroot build install
835 rm -f debian/files debian/substvars
837 ifneq ($(DISTRIBUTION),SLP)
839 # Cross builds do not have documentation packages
842 $(install_dir) $(d_doc)/DEBIAN
844 ifneq ($(BACKPORT),true)
845 $(install_dir) $(d_doc)/$(PF)/share/doc/$(p_doc)/
846 $(install_file) debian/changelog $(d_doc)/$(PF)/share/doc/$(p_doc)/changelog.Debian
847 $(install_file) debian/copyright $(d_doc)/$(PF)/share/doc/$(p_doc)/
848 for i in bfd gas gprof ld; do \
849 ln -sf ../$(p_bin)/$$i $(d_doc)/$(PF)/share/doc/$(p_doc)/$$i; \
851 find $(d_doc)/$(PF)/share/doc/$(p_doc) -maxdepth 1 -type f ! -name copyright | xargs gzip -9
852 gzip -9 $(d_doc)/$(PF)/share/info/*
854 dpkg-gencontrol -isp -P$(d_doc) -p$(p_doc)
855 chown -R root:root $(d_doc)
856 chmod -R go=rX $(d_doc)
857 dpkg --build $(d_doc) ..
859 $(install_dir) $(d_src)/$(PF)/share/doc/$(p_src)/
860 $(install_file) debian/changelog $(d_src)/$(PF)/share/doc/$(p_src)/changelog.Debian
861 $(install_file) debian/copyright $(d_src)/$(PF)/share/doc/$(p_src)/
862 find $(d_src)/$(PF)/share/doc/$(p_src) -maxdepth 1 -type f ! -name copyright | xargs gzip -9
863 endif # ifndef BACKPORT
865 $(install_dir) $(d_src)/DEBIAN
866 $(install_dir) $(d_src)/$(PF)/src/binutils/patches
867 $(install_file) debian/patches/* $(d_src)/$(PF)/src/binutils/patches/
868 tar -c --xz -C .. --exclude=CVS \
869 -f $(pwd)/$(d_src)/$(PF)/src/binutils/binutils-$(VERSION).tar.xz \
872 tar cf - $$(find './debian' -mindepth 1 \( \
873 -path './debian/binutils*' -type d -prune -o \
874 -path './debian/patches' -prune -o \
875 -path './debian/tmp*' -prune -o \
876 -path './debian/.bzr*' -prune -o \
877 -path './debian/files' -prune -o \
879 | tar -x -C $(d_src)/$(PF)/src/binutils -f -
880 -chmod 755 $(d_src)/$(PF)/src/binutils/debian/*.{pre,post}{inst,rm}
881 chmod 755 $(d_src)/$(PF)/src/binutils/debian/test-suite-compare.py
883 dpkg-gencontrol -isp -P$(d_src) -p$(p_src)
884 chown -R root:root $(d_src)
885 chmod -R go=rX $(d_src)
886 dpkg --build $(d_src) ..
891 ################################################################################
893 #######################
894 # binary-arch target #
895 #######################
897 binary-arch: checkroot build install
900 ifneq ($(BACKPORT),true)
901 # Process the following only if $(TARGET) is set
903 test "" != "$(TARGET)"
905 rm -rf $(d_cross)/$(PF)/share/info $(d_cross)/$(PF)/share/man
907 sed "/^$$/ q" < debian/control.in > debian/control
908 sed -e "s/__TARGET__/$$(echo -n $(TARGET) | sed s/_/-/g)/" \
909 < debian/control.cross.in >> debian/control
911 $(install_dir) $(d_cross)/DEBIAN
913 $(install_dir) $(d_cross)/$(PF)/share/doc/$(p_cross)/
914 $(install_file) debian/changelog $(d_cross)/$(PF)/share/doc/$(p_cross)/changelog.Debian
915 $(install_file) debian/copyright debian/README.cross $(d_cross)/$(PF)/share/doc/$(p_cross)/
916 gzip -9f $(d_cross)/$(PF)/share/doc/$(p_cross)/changelog.Debian
918 for pkg in bfd gas gprof ld; do \
919 ln -sf ../binutils/$$pkg $(d_cross)/$(PF)/share/doc/$(p_cross)/$$pkg; \
922 rm -f debian/substvars
923 dpkg-shlibdeps $(d_cross)/$(PF)/bin/*
924 dpkg-gencontrol -isp -P$(d_cross) -p$(p_cross)
925 dpkg --build $(d_cross) ..
928 cp debian/control.in debian/control
929 : # generate some control & helper files
930 nver=$$(echo $(DEB_UPSTREAM) | awk -F. '{ OFS="."; $$NF=$$NF+1; print }'); \
931 for i in debian/*.in; do \
932 case "$$i" in debian/control.cross.in) continue; esac; \
933 sed -e 's/@VER@/$(VERSION)/g' \
934 -e 's/@DEB_VER@/$(DEB_VERSION)/g' \
935 -e 's/@DEB_SVER@/$(DEB_SVERSION)/g' \
936 -e 's/@DEB_UVER@/$(DEB_UPSTREAM)/g' \
937 -e "s/@DEB_NVER@/$$nver/g" \
938 -e 's/@DATE_EXT@/$(DATE_EXT)/g' \
942 : # make lintian happy
943 $(install_file) -D debian/$(p_bin).overrides \
944 $(d_bin)/$(PF)/share/lintian/overrides/$(p_bin)
945 ifeq ($(with_multiarch),yes)
946 $(install_file) -D debian/$(p_mul).overrides \
947 $(d_mul)/$(PF)/share/lintian/overrides/$(p_mul)
949 ifeq ($(with_gold),yes)
950 $(install_file) -D debian/$(p_gold).overrides \
951 $(d_gold)/$(PF)/share/lintian/overrides/$(p_gold)
953 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
954 $(install_file) -D debian/$(p_spu).overrides \
955 $(d_spu)/$(PF)/share/lintian/overrides/$(p_spu)
957 ifeq ($(DEB_HOST_ARCH),hppa)
958 $(install_file) -D debian/$(p_hppa64).overrides \
959 $(d_hppa64)/$(PF)/share/lintian/overrides/$(p_hppa64)
962 : # install maintainer scrtips
963 $(install_dir) $(d_bin)/DEBIAN
964 $(install_script) debian/binutils.postinst $(d_bin)/DEBIAN/postinst
965 $(install_script) debian/binutils.postrm $(d_bin)/DEBIAN/postrm
966 $(install_file) debian/binutils.shlibs $(d_bin)/DEBIAN/shlibs
968 $(install_dir) $(d_dev)/DEBIAN
970 ifeq ($(with_multiarch),yes)
971 $(install_dir) $(d_mul)/DEBIAN
972 $(install_script) debian/binutils-multiarch.preinst $(d_mul)/DEBIAN/preinst
973 $(install_script) debian/binutils-multiarch.postinst $(d_mul)/DEBIAN/postinst
974 $(install_script) debian/binutils-multiarch.prerm $(d_mul)/DEBIAN/prerm
975 $(install_script) debian/binutils-multiarch.postrm $(d_mul)/DEBIAN/postrm
976 $(install_file) debian/binutils-multiarch.shlibs $(d_mul)/DEBIAN/shlibs
979 ifeq ($(with_gold),yes)
980 $(install_dir) $(d_gold)/DEBIAN
981 $(install_script) debian/binutils-gold.postrm $(d_gold)/DEBIAN/postrm
982 $(install_script) debian/binutils-gold.preinst $(d_gold)/DEBIAN/preinst
985 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
986 $(install_dir) $(d_spu)/DEBIAN
987 $(install_script) debian/binutils-spu.postinst $(d_spu)/DEBIAN/postinst
988 $(install_script) debian/binutils-spu.postrm $(d_spu)/DEBIAN/postrm
989 $(install_file) debian/binutils-spu.shlibs $(d_spu)/DEBIAN/shlibs
992 ifeq ($(DEB_HOST_ARCH),hppa)
993 $(install_dir) $(d_hppa64)/DEBIAN
994 $(install_script) debian/binutils-hppa64.postinst $(d_hppa64)/DEBIAN/postinst
995 $(install_script) debian/binutils-hppa64.postrm $(d_hppa64)/DEBIAN/postrm
996 $(install_file) debian/binutils-hppa64.shlibs $(d_hppa64)/DEBIAN/shlibs
1000 $(install_dir) $(d_bin)/$(PF)/share/doc/$(p_bin)/
1001 $(install_file) debian/changelog $(d_bin)/$(PF)/share/doc/$(p_bin)/changelog.Debian
1002 $(install_file) debian/copyright $(d_bin)/$(PF)/share/doc/$(p_bin)/
1004 $(install_dir) $(d_dev)/$(PF)/share/doc/
1005 ln -sf $(p_bin) $(d_dev)/$(PF)/share/doc/$(p_dev)
1006 ifeq ($(with_multiarch),yes)
1007 $(install_dir) $(d_mul)/$(PF)/share/doc/
1008 ln -sf $(p_bin) $(d_mul)/$(PF)/share/doc/$(p_mul)
1010 ifeq ($(with_gold),yes)
1011 $(install_dir) $(d_gold)/$(PF)/share/doc/
1012 ln -sf $(p_bin) $(d_gold)/$(PF)/share/doc/$(p_gold)
1014 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
1015 $(install_dir) $(d_spu)/$(PF)/share/doc/
1016 ln -sf $(p_bin) $(d_spu)/$(PF)/share/doc/$(p_spu)
1018 ifeq ($(DEB_HOST_ARCH),hppa)
1019 $(install_dir) $(d_hppa64)/$(PF)/share/doc/
1020 ln -sf $(p_bin) $(d_hppa64)/$(PF)/share/doc/$(p_hppa64)
1023 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
1024 ifeq ($(with_check),yes)
1025 $(install_file) $(pwd)/test-summary $(d_bin)/$(PF)/share/doc/$(p_bin)/
1028 $(install_file) binutils/NEWS debian/README.cross \
1029 $(d_bin)/$(PF)/share/doc/$(p_bin)/
1031 $(install_file) binutils/ChangeLog $(d_bin)/$(PF)/share/doc/$(p_bin)/changelog
1033 for pkg in bfd gas gprof ld; do \
1034 $(install_dir) $(d_bin)/$(PF)/share/doc/$(p_bin)/$$pkg; \
1036 $(install_file) bfd/ChangeLog bfd/PORTING bfd/TODO \
1037 $(d_bin)/$(PF)/share/doc/$(p_bin)/bfd/
1038 $(install_file) gas/ChangeLog gas/NEWS $(d_bin)/$(PF)/share/doc/$(p_bin)/gas/
1039 $(install_file) gprof/ChangeLog gprof/TODO gprof/TEST \
1040 $(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/
1041 $(install_file) ld/ChangeLog ld/TODO ld/NEWS \
1042 $(d_bin)/$(PF)/share/doc/$(p_bin)/ld/
1044 : # These only exist in H. J. Lu releases not GNU ones.
1045 for dir in binutils bfd gas gprof ld; do \
1046 if [ -f $$dir/ChangeLog.linux ]; then \
1047 $(install_file) $$dir/ChangeLog.linux $(d_bin)/$(PF)/share/doc/$(p_bin)/$$dir/; \
1051 : # Copy bbconv.pl to the doc dir for use by interested people
1052 $(install_file) gprof/bbconv.pl $(d_bin)/$(PF)/share/doc/$(p_bin)/gprof/.
1054 : # Compress stuff that needs it
1055 gzip -9 $(d_bin)/$(PF)/share/man/man1/*.1
1056 find $(d_bin)/$(PF)/share/doc/$(p_bin)/ -type f ! -name copyright -a ! -name bbconv.pl | xargs gzip -9
1058 : # Finish it all up
1059 find $(d_bin) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
1060 dpkg-gencontrol -isp -P$(d_bin) -p$(p_bin) $(CONFLICTS)
1062 rm -f debian/substvars
1063 dpkg-gencontrol -isp -P$(d_dev) -p$(p_dev)
1065 ifeq ($(with_multiarch),yes)
1066 rm -f debian/substvars
1067 find $(d_mul) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
1068 dpkg-gencontrol -isp -P$(d_mul) -p$(p_mul)
1071 ifeq ($(with_gold),yes)
1072 rm -f debian/substvars
1074 # find $(d_gold) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
1075 dpkg-gencontrol -isp -P$(d_gold) -p$(p_gold)
1077 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
1078 rm -f debian/substvars
1079 find $(d_spu) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
1080 dpkg-gencontrol -isp -P$(d_spu) -p$(p_spu)
1082 ifeq ($(DEB_HOST_ARCH),hppa)
1083 rm -f debian/substvars
1084 find $(d_hppa64) -type f | xargs file | grep ELF | cut -d: -f 1 | xargs dpkg-shlibdeps
1085 dpkg-gencontrol -isp -P$(d_hppa64) -p$(p_hppa64)
1088 chown -R root:root $(d_bin) $(d_dev)
1089 chmod -R go=rX $(d_bin) $(d_dev)
1090 dpkg --build $(d_bin) ..
1091 dpkg --build $(d_dev) ..
1092 ifeq ($(with_multiarch),yes)
1093 chown -R root:root $(d_mul)
1094 chmod -R go=rX $(d_mul)
1095 dpkg --build $(d_mul) ..
1097 ifeq ($(with_gold),yes)
1098 chown -R root:root $(d_gold)
1099 chmod -R go=rX $(d_gold)
1100 dpkg --build $(d_gold) ..
1102 ifneq (,$(filter $(DEB_HOST_ARCH),powerpc ppc64))
1103 chown -R root:root $(d_spu)
1104 chmod -R go=rX $(d_spu)
1105 dpkg --build $(d_spu) ..
1107 ifeq ($(DEB_HOST_ARCH),hppa)
1108 chown -R root:root $(d_hppa64)
1109 chmod -R go=rX $(d_hppa64)
1110 dpkg --build $(d_hppa64) ..
1113 endif # Process the following only if $(TARGET) is set
1114 endif # ifndef BACKPORT
1115 ################################################################################
1122 # Support TARGET both as Debian architecture specification (e.g. arm),
1123 # and as the target name (e.g. arm-linux-gnu).
1124 try_convert := $(shell dpkg-architecture -f -a$(TARGET) -qDEB_HOST_GNU_TYPE 2>/dev/null)
1125 ifneq ($(try_convert),)
1126 override TARGET := $(try_convert)
1129 # Process the following only if $(TARGET) is set
1132 p_cross = $(subst _,-,binutils-$(TARGET))
1133 d_cross = debian/$(p_cross)
1135 ifneq ($(filter sparc-linux-gnu powerpc-linux-gnu mips-linux-gnu, $(TARGET)),)
1136 ADDITIONAL_TARGETS = --enable-targets=$(TARGET:%-linux-gnu=%64-linux-gnu)
1138 ifneq ($(filter i386-linux-gnu i486-linux-gnu i586-linux-gnu i686-linux-gnu x86-linux-gnu, $(TARGET)),)
1139 ADDITIONAL_TARGETS = --enable-targets=x86_64-linux-gnu
1141 ifneq ($(filter i386-kfreebsd-gnu i486-kfreebsd-gnu i586-kfreebsd-gnu x86-kfreebsd-gnu, $(TARGET)),)
1142 ADDITIONAL_TARGETS = --enable-targets=x86_64-linux-gnu
1144 ifeq ($(TARGET), x86_64-linux-gnu)
1145 ADDITIONAL_TARGETS = --enable-targets=i486-linux-gnu
1147 ifeq ($(TARGET), x86_64-kfreebsd-gnu)
1148 ADDITIONAL_TARGETS = --enable-targets=i486-kfreebsd-gnu
1150 ifeq ($(TARGET), mipsel-linux-gnu)
1151 ADDITIONAL_TARGETS = --enable-targets=mips64el-linux-gnu
1153 ifeq ($(TARGET), sparc64-linux-gnu)
1154 ADDITIONAL_TARGETS = --enable-targets=sparc-linux-gnu
1156 ifeq ($(TARGET), s390-linux-gnu)
1157 ADDITIONAL_TARGETS = --enable-targets=s390x-linux-gnu
1159 ifeq ($(TARGET), s390x-linux-gnu)
1160 ADDITIONAL_TARGETS = --enable-targets=s390-linux-gnu
1163 #-----------------------------------------------------------------
1166 with_sysroot = $(WITH_SYSROOT)
1168 ifdef WITH_BUILD_SYSROOT
1169 with_build_sysroot = $(WITH_BUILD_SYSROOT)
1172 CROSS_CONFARGS := $(ADDITIONAL_TARGETS) $(CONFARGS)
1173 ifneq ($(with_sysroot),)
1174 CROSS_CONFARGS += --with-sysroot=$(with_sysroot)
1176 ifneq ($(with_build_sysroot),)
1177 CROSS_CONFARGS += --with-build-sysroot=$(with_build_sysroot)
1179 ifeq ($(with_gold),yes)
1180 CROSS_CONFARGS += --enable-ld=default --enable-gold
1183 configure-cross-stamp: patch-stamp patch-cross-stamp
1185 test "" != "$(TARGET)"
1186 rm -rf configure-cross-stamp builddir-$(TARGET)
1187 mkdir builddir-$(TARGET)
1188 cd builddir-$(TARGET) \
1189 && env CC="$(CC)" CXX="$(CXX)" ../configure --host=$(DEB_HOST_GNU_TYPE) \
1190 --build=$(DEB_BUILD_GNU_TYPE) --target=$(TARGET) --prefix=/$(PF) \
1194 build-cross-stamp: configure-cross-stamp
1196 test "" != "$(TARGET)"
1197 $(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)"
1200 install-cross-stamp: build-cross-stamp
1202 test "" != "$(TARGET)"
1204 $(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/$(PF) \
1205 mandir=$(pwd)/$(d_cross)/$(PF)/share/man install
1206 rm -rf $(d_cross)/$(PF)/lib* $(d_cross)/$(PF)/info $(d_cross)/$(PF)/share/locale
1207 ifeq ($(with_strip),yes)
1208 $(STRIP) $$(file $(d_cross)/$(PF)/bin/* | awk -F: '$$0 !~ /script/ {print $$1}')
1210 chmod ugo-x $(d_cross)/$(PF)/$(DEB_HOST_GNU_TYPE)/$(TARGET)/lib/*.so
1212 gzip -9 $(d_cross)/$(PF)/share/man/man1/*
1215 configure-host-cross-stamp: configure-cross-stamp
1217 test "" != "$(TARGET)"
1218 $(MAKE) configure-host -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)"
1221 build-static-cross-stamp: configure-host-cross-stamp
1223 test "" != "$(TARGET)"
1224 $(MAKE) -C builddir-$(TARGET) $(NJOBS) CFLAGS="$(CFLAGS)" LDFLAGS="-all-static"
1227 install-static-cross-stamp: build-static-cross-stamp install-cross-stamp
1230 @echo "Please use dpkg-buildpackage instead of calling binary-cross directly; see README.cross"
1235 ################################################################################
1238 test -f bfd/elf32.c -a -f debian/rules
1241 # Below here is fairly generic really
1243 binary: binary-indep binary-arch
1247 test root = "`whoami`"
1249 .PHONY: binary binary-arch binary-indep clean checkroot