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.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 35CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized 36.endif 37 38# We implement a slightly non-standard %S in that it always takes a 39# CHAR16 that's common in UEFI-land instead of a wchar_t. This only 40# seems to matter on arm64 where wchar_t defaults to an int instead 41# of a short. There's no good cast to use here so just ignore the 42# warnings for now. 43CWARNFLAGS.main.c+= -Wno-format 44 45.PATH: ${.CURDIR}/../loader 46.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 47.include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc" 48 49CFLAGS+= -I${.CURDIR} 50CFLAGS+= -I${.CURDIR}/arch/${MACHINE} 51CFLAGS+= -I${EFISRC}/include 52CFLAGS+= -I${EFISRC}/include/${MACHINE} 53CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include 54CFLAGS+= -I${BOOTSRC}/i386/libi386 55CFLAGS+= -DEFI 56 57.if defined(HAVE_FDT) && ${MK_FDT} != "no" 58.include "${BOOTSRC}/fdt.mk" 59LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a 60.endif 61 62# Include bcache code. 63HAVE_BCACHE= yes 64 65.if defined(EFI_STAGING_SIZE) 66CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE} 67.endif 68 69.if ${MK_LOADER_EFI_SECUREBOOT} != "no" 70CFLAGS+= -DEFI_SECUREBOOT 71.endif 72 73NEWVERSWHAT= "EFI loader" ${MACHINE} 74VERSION_FILE= ${.CURDIR}/../loader/version 75 76# Always add MI sources 77.include "${BOOTSRC}/loader.mk" 78 79FILES+= ${LOADER}.efi 80FILESMODE_${LOADER}.efi= ${BINMODE} 81 82.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} 83LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi 84.endif 85 86LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 87LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared 88 89CLEANFILES+= loader.efi 90 91${LOADER}.efi: ${PROG} 92 if ${NM} ${.ALLSRC} | grep ' U '; then \ 93 echo "Undefined symbols in ${.ALLSRC}"; \ 94 exit 1; \ 95 fi 96 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 97 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 98 -j .dynamic -j .dynsym -j .rel.dyn \ 99 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ 100 -j set_Xficl_compile_set \ 101 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 102 103LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a 104 105DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} 106LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} 107 108.include <bsd.prog.mk> 109