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