1 #!/usr/bin/make -f 2 3 buildarch := $(shell dpkg-architecture -qDEB_BUILD_ARCH) 4 ifneq (,$(findstring i386,$(buildarch))) 5 efiarch := ia32 6 else ifneq (,$(findstring amd64,$(buildarch))) 7 efiarch := x86_64 8 else 9 efiarch := $(buildarch) 10 endif 11 12 build: build-stamp 13 build-stamp: 14 dh_testdir 15 16 ifneq (,$(findstring amd64,$(buildarch))) 17 mkdir build-ia32 18 $(MAKE) -C build-ia32 -f ../Makefile SRCDIR=.. ARCH=ia32 19 endif 20 21 ifneq (,$(findstring i386,$(buildarch))) 22 mkdir build-x86_64 23 $(MAKE) -C build-x86_64 -f ../Makefile SRCDIR=.. ARCH=x86_64 24 endif 25 26 $(MAKE) 27 28 touch build-stamp 29 30 clean: 31 dh_testdir 32 dh_testroot 33 rm -f build-stamp configure-stamp 34 [ ! -f Makefile ] || $(MAKE) clean 35 rm -rf build-ia32 build-x86_64 36 dh_clean 37 38 install: build 39 dh_testdir 40 dh_testroot 41 dh_clean -k 42 dh_installdirs -A 43 44 # gnu-efi files 45 cp -r inc/* debian/gnu-efi/usr/include/efi/ 46 rm debian/gnu-efi/usr/include/efi/Makefile 47 rm debian/gnu-efi/usr/include/efi/inc.mak 48 rm debian/gnu-efi/usr/include/efi/make.inf 49 rm debian/gnu-efi/usr/include/efi/makefile.hdr 50 rm debian/gnu-efi/usr/include/efi/protocol/make.inf 51 rm debian/gnu-efi/usr/include/efi/protocol/makefile.hdr 52 rm debian/gnu-efi/usr/include/efi/protocol/readme.txt 53 ifeq ($(buildarch),ia64) 54 rm -rf debian/gnu-efi/usr/include/efi/ia32 55 rm -rf debian/gnu-efi/usr/include/efi/x84_64 56 else 57 rm -rf debian/gnu-efi/usr/include/efi/ia64 58 endif 59 cp gnuefi/*.a debian/gnu-efi/usr/lib/ 60 ifeq ($(buildarch),kfreebsd-amd64) 61 cp gnuefi/elf_$(efiarch)_fbsd_efi.lds debian/gnu-efi/usr/lib 62 else 63 cp gnuefi/elf_$(efiarch)_efi.lds debian/gnu-efi/usr/lib 64 endif 65 cp gnuefi/crt0-efi-$(efiarch).o debian/gnu-efi/usr/lib 66 cp lib/*.a debian/gnu-efi/usr/lib/ 67 68 ifneq (,$(findstring amd64,$(buildarch))) 69 mkdir -p debian/gnu-efi/usr/lib32 70 cp build-ia32/gnuefi/*.a debian/gnu-efi/usr/lib32/ 71 cp gnuefi/elf_ia32_efi.lds debian/gnu-efi/usr/lib32/ 72 cp build-ia32/gnuefi/crt0-efi-ia32.o debian/gnu-efi/usr/lib32/ 73 cp build-ia32/lib/*.a debian/gnu-efi/usr/lib32/ 74 endif 75 76 ifneq (,$(findstring i386,$(buildarch))) 77 mkdir -p debian/gnu-efi/usr/lib64 78 cp build-x86_64/gnuefi/*.a debian/gnu-efi/usr/lib64/ 79 ifeq ($(buildarch),kfreebsd-i386) 80 cp gnuefi/elf_x86_64_fbsd_efi.lds debian/gnu-efi/usr/lib64/ 81 else 82 cp gnuefi/elf_x86_64_efi.lds debian/gnu-efi/usr/lib64/ 83 endif 84 cp build-x86_64/gnuefi/crt0-efi-x86_64.o debian/gnu-efi/usr/lib64/ 85 cp build-x86_64/lib/*.a debian/gnu-efi/usr/lib64/ 86 endif 87 88 # Build architecture-independent files here. 89 binary-indep: build install 90 # We have nothing to do by default. 91 92 # Build architecture-dependent files here. 93 binary-arch: build install 94 dh_testdir 95 dh_testroot 96 dh_installdocs -a 97 dh_installchangelogs -a ChangeLog 98 dh_link 99 dh_strip 100 dh_compress 101 dh_fixperms 102 dh_installdeb 103 dh_shlibdeps 104 dh_gencontrol 105 dh_md5sums 106 dh_builddeb 107 108 binary: binary-indep binary-arch 109 .PHONY: build clean binary-indep binary-arch binary install configure 110