1#!/usr/bin/make -f 2 3buildarch := $(shell dpkg-architecture -qDEB_BUILD_ARCH) 4ifneq (,$(findstring i386,$(buildarch))) 5 efiarch := ia32 6else ifneq (,$(findstring amd64,$(buildarch))) 7 efiarch := x86_64 8else 9 efiarch := $(buildarch) 10endif 11 12build: build-stamp 13build-stamp: 14 dh_testdir 15 16ifneq (,$(findstring amd64,$(buildarch))) 17 mkdir build-ia32 18 $(MAKE) -C build-ia32 -f ../Makefile SRCDIR=.. ARCH=ia32 19endif 20 21ifneq (,$(findstring i386,$(buildarch))) 22 mkdir build-x86_64 23 $(MAKE) -C build-x86_64 -f ../Makefile SRCDIR=.. ARCH=x86_64 24endif 25 26 $(MAKE) 27 28 touch build-stamp 29 30clean: 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 38install: 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 53ifeq ($(buildarch),ia64) 54 rm -rf debian/gnu-efi/usr/include/efi/ia32 55 rm -rf debian/gnu-efi/usr/include/efi/x84_64 56else 57 rm -rf debian/gnu-efi/usr/include/efi/ia64 58endif 59 cp gnuefi/*.a debian/gnu-efi/usr/lib/ 60ifeq ($(buildarch),kfreebsd-amd64) 61 cp gnuefi/elf_$(efiarch)_fbsd_efi.lds debian/gnu-efi/usr/lib 62else 63 cp gnuefi/elf_$(efiarch)_efi.lds debian/gnu-efi/usr/lib 64endif 65 cp gnuefi/crt0-efi-$(efiarch).o debian/gnu-efi/usr/lib 66 cp lib/*.a debian/gnu-efi/usr/lib/ 67 68ifneq (,$(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/ 74endif 75 76ifneq (,$(findstring i386,$(buildarch))) 77 mkdir -p debian/gnu-efi/usr/lib64 78 cp build-x86_64/gnuefi/*.a debian/gnu-efi/usr/lib64/ 79ifeq ($(buildarch),kfreebsd-i386) 80 cp gnuefi/elf_x86_64_fbsd_efi.lds debian/gnu-efi/usr/lib64/ 81else 82 cp gnuefi/elf_x86_64_efi.lds debian/gnu-efi/usr/lib64/ 83endif 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/ 86endif 87 88# Build architecture-independent files here. 89binary-indep: build install 90# We have nothing to do by default. 91 92# Build architecture-dependent files here. 93binary-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 108binary: binary-indep binary-arch 109.PHONY: build clean binary-indep binary-arch binary install configure 110