1 1.7.2.2 pgoyette # $NetBSD: Makefile.efiboot,v 1.7.2.2 2017/03/20 06:57:15 pgoyette Exp $ 2 1.7.2.2 pgoyette 3 1.7.2.2 pgoyette S= ${.CURDIR}/../../../../.. 4 1.7.2.2 pgoyette 5 1.7.2.2 pgoyette NOMAN= # defined 6 1.7.2.2 pgoyette PROG?= boot.efi 7 1.7.2.2 pgoyette NEWVERSWHAT?= "EFI Boot" 8 1.7.2.2 pgoyette VERSIONFILE?= ${.CURDIR}/../version 9 1.7.2.2 pgoyette 10 1.7.2.2 pgoyette AFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:} 11 1.7.2.2 pgoyette 12 1.7.2.2 pgoyette SOURCES?= start.S conf.c devopen.c efiboot.c self_reloc.c 13 1.7.2.2 pgoyette LIBI386SRCS= boot.c biosdisk.c bootinfo.c bootinfo_biosgeom.c 14 1.7.2.2 pgoyette LIBI386SRCS+= bootmenu.c boot_params.S diskbuf.c exec.c menuutils.c 15 1.7.2.2 pgoyette LIBI386SRCS+= panic.c parseutils.c pread.c 16 1.7.2.2 pgoyette LIBI386SRCS+= eficons.c efidelay.c efidisk.c efidisk_ll.c efigetsecs.c 17 1.7.2.2 pgoyette LIBI386SRCS+= efimemory.c 18 1.7.2.2 pgoyette SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS} 19 1.7.2.2 pgoyette .if !make(depend) 20 1.7.2.2 pgoyette SRCS+= vers.c 21 1.7.2.2 pgoyette .endif 22 1.7.2.2 pgoyette 23 1.7.2.2 pgoyette PIE_CFLAGS= 24 1.7.2.2 pgoyette PIE_LDFLAGS= 25 1.7.2.2 pgoyette PIE_AFLAGS= 26 1.7.2.2 pgoyette 27 1.7.2.2 pgoyette .include <bsd.own.mk> 28 1.7.2.2 pgoyette 29 1.7.2.2 pgoyette STRIPFLAG= # nothing 30 1.7.2.2 pgoyette 31 1.7.2.2 pgoyette LIBCRT0= # nothing 32 1.7.2.2 pgoyette LIBCRTI= # nothing 33 1.7.2.2 pgoyette LIBCRTBEGIN= # nothing 34 1.7.2.2 pgoyette LIBCRTEND= # nothing 35 1.7.2.2 pgoyette LIBC= # nothing 36 1.7.2.2 pgoyette 37 1.7.2.2 pgoyette BINDIR=/usr/mdec 38 1.7.2.2 pgoyette BINMODE=444 39 1.7.2.2 pgoyette 40 1.7.2.2 pgoyette .PATH: ${.CURDIR} ${.CURDIR}/.. 41 1.7.2.2 pgoyette .PATH: ${.CURDIR}/../../lib 42 1.7.2.2 pgoyette 43 1.7.2.2 pgoyette LDSCRIPT?= ${.CURDIR}/ldscript 44 1.7.2.2 pgoyette LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc 45 1.7.2.2 pgoyette CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/.. -I$S/lib/libsa 46 1.7.2.2 pgoyette CPPFLAGS+= -I${.OBJDIR} 47 1.7.2.2 pgoyette CPPFLAGS+= -I${.CURDIR}/../../lib 48 1.7.2.2 pgoyette 49 1.7.2.2 pgoyette COPTS+= -ffreestanding -fPIC -fshort-wchar -fno-strict-aliasing -fno-builtin 50 1.7.2.2 pgoyette COPTS+= -fno-stack-protector 51 1.7.2.2 pgoyette COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :} 52 1.7.2.2 pgoyette CPPFLAGS+= -nostdinc -D_STANDALONE 53 1.7.2.2 pgoyette CPPFLAGS+= -DEFIBOOT 54 1.7.2.2 pgoyette 55 1.7.2.2 pgoyette CPPFLAGS+= -Wall -Wmissing-prototypes 56 1.7.2.2 pgoyette CPPFLAGS+= -Wno-pointer-sign 57 1.7.2.2 pgoyette 58 1.7.2.2 pgoyette CPPFLAGS+= -DEFI_ALLOCATE_MAX_ADDRESS=0x100000000ULL 59 1.7.2.2 pgoyette CPPFLAGS+= -DHEAP_VARIABLE 60 1.7.2.2 pgoyette CPPFLAGS+= -DSUPPORT_CD9660 61 1.7.2.2 pgoyette CPPFLAGS+= -DSUPPORT_DOSFS 62 1.7.2.2 pgoyette CPPFLAGS+= -DSUPPORT_EXT2FS 63 1.7.2.2 pgoyette CPPFLAGS+= -DPASS_BIOSGEOM 64 1.7.2.2 pgoyette CPPFLAGS+= -DLIBSA_ENABLE_LS_OP 65 1.7.2.2 pgoyette 66 1.7.2.2 pgoyette EFIDIR= ${S}/external/bsd/gnu-efi/dist 67 1.7.2.2 pgoyette GNUEFIARCH?= ${MACHINE_CPU} 68 1.7.2.2 pgoyette CPPFLAGS+= -I${EFIDIR}/inc -I${EFIDIR}/inc/${GNUEFIARCH} 69 1.7.2.2 pgoyette CPPFLAGS+= -I${EFIDIR}/inc/protocol 70 1.7.2.2 pgoyette 71 1.7.2.2 pgoyette SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT 72 1.7.2.2 pgoyette SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT 73 1.7.2.2 pgoyette SAMISCMAKEFLAGS+= SA_USE_CREAD=yes # Read compressed kernels 74 1.7.2.2 pgoyette SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no # Netboot via TFTP, NFS 75 1.7.2.2 pgoyette 76 1.7.2.2 pgoyette ### find out what to use for libsa 77 1.7.2.2 pgoyette SA_AS= library 78 1.7.2.2 pgoyette SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 79 1.7.2.2 pgoyette SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes" 80 1.7.2.2 pgoyette .include "${S}/lib/libsa/Makefile.inc" 81 1.7.2.2 pgoyette LIBSA= ${SALIB} 82 1.7.2.2 pgoyette 83 1.7.2.2 pgoyette ### find out what to use for libkern 84 1.7.2.2 pgoyette KERN_AS= library 85 1.7.2.2 pgoyette LIBKERN_ARCH?= ${MACHINE_ARCH} 86 1.7.2.2 pgoyette KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}" 87 1.7.2.2 pgoyette .include "${S}/lib/libkern/Makefile.inc" 88 1.7.2.2 pgoyette LIBKERN= ${KERNLIB} 89 1.7.2.2 pgoyette 90 1.7.2.2 pgoyette ### find out what to use for libz 91 1.7.2.2 pgoyette Z_AS= library 92 1.7.2.2 pgoyette .include "${S}/lib/libz/Makefile.inc" 93 1.7.2.2 pgoyette LIBZ= ${ZLIB} 94 1.7.2.2 pgoyette 95 1.7.2.2 pgoyette ### find out what to use for libgnuefi 96 1.7.2.2 pgoyette GNUEFI_AS= library 97 1.7.2.2 pgoyette LIBGNUEFI_ARCH?= ${MACHINE_ARCH} 98 1.7.2.2 pgoyette GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}" 99 1.7.2.2 pgoyette GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib 100 1.7.2.2 pgoyette .include "${S}/lib/libgnuefi/Makefile.inc" 101 1.7.2.2 pgoyette LIBGNUEFI= ${GNUEFILIB} 102 1.7.2.2 pgoyette 103 1.7.2.2 pgoyette cleandir distclean: .WAIT cleanlibdir 104 1.7.2.2 pgoyette 105 1.7.2.2 pgoyette cleanlibdir: 106 1.7.2.2 pgoyette -rm -rf lib 107 1.7.2.2 pgoyette 108 1.7.2.2 pgoyette LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA} 109 1.7.2.2 pgoyette 110 1.7.2.2 pgoyette CLEANFILES+= vers.c 111 1.7.2.2 pgoyette 112 1.7.2.2 pgoyette vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.efiboot 113 1.7.2.2 pgoyette ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT} 114 1.7.2.2 pgoyette 115 1.7.2.2 pgoyette CLEANFILES+= ${PROG}.so ${PROG}.tmp 116 1.7.2.2 pgoyette 117 1.7.2.2 pgoyette ${PROG}: ${PROG}.so 118 1.7.2.2 pgoyette ${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ 119 1.7.2.2 pgoyette -j .rel -j .rel.* -j .rela -j .rela.* -j .reloc \ 120 1.7.2.2 pgoyette --subsystem efi-app --target=${OBJFMT} ${PROG}.so ${.TARGET} 121 1.7.2.2 pgoyette 122 1.7.2.2 pgoyette .include <bsd.prog.mk> 123 1.7.2.2 pgoyette 124 1.7.2.2 pgoyette ${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot 125 1.7.2.2 pgoyette ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST} 126 1.7.2.2 pgoyette @if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \ 127 1.7.2.2 pgoyette (echo Undefined symbols; false); \ 128 1.7.2.2 pgoyette fi 129 1.7.2.2 pgoyette rm -f ${.TARGET} 130 1.7.2.2 pgoyette mv ${.TARGET}.tmp ${.TARGET} 131 1.7.2.2 pgoyette 132 1.7.2.2 pgoyette KLINK_MACHINE?= ${MACHINE} 133 1.7.2.2 pgoyette .include <bsd.klinks.mk> 134