1# $FreeBSD$ 2 3LOADER_NET_SUPPORT?= yes 4LOADER_MSDOS_SUPPORT?= yes 5LOADER_UFS_SUPPORT?= yes 6LOADER_CD9660_SUPPORT?= no 7LOADER_EXT2FS_SUPPORT?= no 8 9.include <bsd.init.mk> 10 11LOADER?= loader_${LOADER_INTERP} 12PROG= ${LOADER}.sym 13INTERNALPROG= 14WARNS?= 3 15 16# architecture-specific loader code 17SRCS= autoload.c \ 18 bootinfo.c \ 19 conf.c \ 20 copy.c \ 21 efi_main.c \ 22 framebuffer.c \ 23 main.c \ 24 self_reloc.c \ 25 vers.c 26 27CFLAGS+= -I${.CURDIR}/../loader 28.if ${MK_LOADER_ZFS} != "no" 29CFLAGS+= -I${ZFSSRC} 30CFLAGS+= -DEFI_ZFS_BOOT 31HAVE_ZFS= yes 32.endif 33 34# We implement a slightly non-standard %S in that it always takes a 35# CHAR16 that's common in UEFI-land instead of a wchar_t. This only 36# seems to matter on arm64 where wchar_t defaults to an int instead 37# of a short. There's no good cast to use here so just ignore the 38# warnings for now. 39CWARNFLAGS.main.c+= -Wno-format 40 41.PATH: ${.CURDIR}/../loader 42.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 43.include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc" 44 45CFLAGS+= -I${.CURDIR} 46CFLAGS+= -I${.CURDIR}/arch/${MACHINE} 47CFLAGS+= -I${EFISRC}/include 48CFLAGS+= -I${EFISRC}/include/${MACHINE} 49CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include 50CFLAGS+= -I${BOOTSRC}/i386/libi386 51CFLAGS+= -DEFI 52 53.if defined(HAVE_FDT) && ${MK_FDT} != "no" 54.include "${BOOTSRC}/fdt.mk" 55LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a 56.endif 57 58# Include bcache code. 59HAVE_BCACHE= yes 60 61.if defined(EFI_STAGING_SIZE) 62CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} 63.endif 64 65.if ${MK_LOADER_EFI_SECUREBOOT} != "no" 66CFLAGS+= -DEFI_SECUREBOOT 67.endif 68 69NEWVERSWHAT= "EFI loader" ${MACHINE} 70VERSION_FILE= ${.CURDIR}/../loader/version 71 72# Always add MI sources 73.include "${BOOTSRC}/loader.mk" 74 75FILES+= ${LOADER}.efi 76FILESMODE_${LOADER}.efi= ${BINMODE} 77 78.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} 79LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi 80.endif 81 82LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 83LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared 84 85CLEANFILES+= loader.efi 86 87${LOADER}.efi: ${PROG} 88 if ${NM} ${.ALLSRC} | grep ' U '; then \ 89 echo "Undefined symbols in ${.ALLSRC}"; \ 90 exit 1; \ 91 fi 92 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 93 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 94 -j .dynamic -j .dynsym -j .rel.dyn \ 95 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ 96 -j set_Xficl_compile_set \ 97 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 98 99LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a 100 101DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} 102LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} 103 104.include <bsd.prog.mk> 105