3 LOADER_NET_SUPPORT?= yes
4 LOADER_MSDOS_SUPPORT?= yes
5 LOADER_UFS_SUPPORT?= yes
6 LOADER_CD9660_SUPPORT?= no
7 LOADER_EXT2FS_SUPPORT?= no
11 LOADER?= loader_${LOADER_INTERP}
16 # architecture-specific loader code
28 CFLAGS+= -I${.CURDIR}/../loader
29 .if ${MK_LOADER_ZFS} != "no"
31 CFLAGS+= -DEFI_ZFS_BOOT
35 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
36 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized
39 # We implement a slightly non-standard %S in that it always takes a
40 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
41 # seems to matter on arm64 where wchar_t defaults to an int instead
42 # of a short. There's no good cast to use here so just ignore the
44 CWARNFLAGS.main.c+= -Wno-format
46 .PATH: ${.CURDIR}/../loader
47 .PATH: ${.CURDIR}/../loader/arch/${MACHINE}
48 # For smbios.c XXX need to abstract properly
49 .PATH: ${BOOTSRC}/i386/libi386
50 .include "${.CURDIR}/../loader/arch/${MACHINE}/Makefile.inc"
53 CFLAGS+= -I${.CURDIR}/arch/${MACHINE}
54 CFLAGS+= -I${EFISRC}/include
55 CFLAGS+= -I${EFISRC}/include/${MACHINE}
56 CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include
57 CFLAGS+= -I${BOOTSRC}/i386/libi386
58 CFLAGS+= -DNO_PCI -DEFI
60 .if !defined(BOOT_HIDE_SERIAL_NUMBERS)
61 # Export serial numbers, UUID, and asset tag from loader.
62 CFLAGS+= -DSMBIOS_SERIAL_NUMBERS
63 .if defined(BOOT_LITTLE_ENDIAN_UUID)
64 # Use little-endian UUID format as defined in SMBIOS 2.6.
65 CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID
66 .elif defined(BOOT_NETWORK_ENDIAN_UUID)
67 # Use network-endian UUID format for backward compatibility.
68 CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID
72 .if defined(HAVE_FDT) && ${MK_FDT} != "no"
73 .include "${BOOTSRC}/fdt.mk"
74 LIBEFI_FDT= ${BOOTOBJ}/efi/fdt/libefi_fdt.a
77 # Include bcache code.
80 .if defined(EFI_STAGING_SIZE)
81 CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
84 NEWVERSWHAT= "EFI loader" ${MACHINE}
85 VERSION_FILE= ${.CURDIR}/../loader/version
87 # Always add MI sources
88 .include "${BOOTSRC}/loader.mk"
91 FILESMODE_${LOADER}.efi= ${BINMODE}
93 .if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
94 LINKS+= ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi
97 LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
98 LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
100 CLEANFILES+= loader.efi
102 ${LOADER}.efi: ${PROG}
103 if ${NM} ${.ALLSRC} | grep ' U '; then \
104 echo "Undefined symbols in ${.ALLSRC}"; \
107 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
108 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
109 -j .dynamic -j .dynsym -j .rel.dyn \
110 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
111 -j set_Xficl_compile_set \
112 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
114 LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a
116 DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT}
117 LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
119 .include <bsd.prog.mk>