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