]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/efi/loader/Makefile
MFC r336535: Hoist EFI_TARGET and SOURCE_DATE_EPOCH up into efi/Makefile.inc
[FreeBSD/FreeBSD.git] / stand / efi / loader / Makefile
1 # $FreeBSD$
2
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
8
9 .include <bsd.init.mk>
10
11 PROG=           loader.sym
12 INTERNALPROG=
13 WARNS?=         3
14
15 # architecture-specific loader code
16 SRCS=   autoload.c \
17         bootinfo.c \
18         conf.c \
19         copy.c \
20         efi_main.c \
21         framebuffer.c \
22         main.c \
23         self_reloc.c \
24         smbios.c \
25         vers.c
26
27 .if ${MK_LOADER_ZFS} != "no"
28 CFLAGS+=        -I${ZFSSRC}
29 CFLAGS+=        -DEFI_ZFS_BOOT
30 HAVE_ZFS=       yes
31 .endif
32
33 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
34 CWARNFLAGS.self_reloc.c+=       -Wno-error=maybe-uninitialized
35 .endif
36
37 # We implement a slightly non-standard %S in that it always takes a
38 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
39 # seems to matter on arm64 where wchar_t defaults to an int instead
40 # of a short. There's no good cast to use here so just ignore the
41 # warnings for now.
42 CWARNFLAGS.main.c+=     -Wno-format
43
44 .PATH: ${.CURDIR}/arch/${MACHINE}
45 # For smbios.c
46 .PATH: ${BOOTSRC}/i386/libi386
47 .include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
48
49 CFLAGS+=        -I${.CURDIR}
50 CFLAGS+=        -I${.CURDIR}/arch/${MACHINE}
51 CFLAGS+=        -I${EFISRC}/include
52 CFLAGS+=        -I${EFISRC}/include/${MACHINE}
53 CFLAGS+=        -I${SYSDIR}/contrib/dev/acpica/include
54 CFLAGS+=        -I${BOOTSRC}/i386/libi386
55 CFLAGS+=        -DNO_PCI -DEFI
56
57 .if !defined(BOOT_HIDE_SERIAL_NUMBERS)
58 # Export serial numbers, UUID, and asset tag from loader.
59 CFLAGS+= -DSMBIOS_SERIAL_NUMBERS
60 .if defined(BOOT_LITTLE_ENDIAN_UUID)
61 # Use little-endian UUID format as defined in SMBIOS 2.6.
62 CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID
63 .elif defined(BOOT_NETWORK_ENDIAN_UUID)
64 # Use network-endian UUID format for backward compatibility.
65 CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID
66 .endif
67 .endif
68
69 .if defined(HAVE_FDT) && ${MK_FDT} != "no"
70 .include        "${BOOTSRC}/fdt.mk"
71 LIBEFI_FDT=     ${BOOTOBJ}/efi/fdt/libefi_fdt.a
72 .endif
73
74 # Include bcache code.
75 HAVE_BCACHE=    yes
76
77 .if defined(EFI_STAGING_SIZE)
78 CFLAGS+=        -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
79 .endif
80
81 # Always add MI sources
82 .include        "${BOOTSRC}/loader.mk"
83
84 FILES+= loader.efi
85 FILESMODE_loader.efi=   ${BINMODE}
86
87 LDSCRIPT=       ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
88 LDFLAGS+=       -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
89
90 CLEANFILES+=    loader.efi
91
92 NEWVERSWHAT=    "EFI loader" ${MACHINE}
93
94 loader.efi: ${PROG}
95         if ${NM} ${.ALLSRC} | grep ' U '; then \
96                 echo "Undefined symbols in ${.ALLSRC}"; \
97                 exit 1; \
98         fi
99         SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
100         ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
101                 -j .dynamic -j .dynsym -j .rel.dyn \
102                 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
103                 -j set_Xficl_compile_set \
104                 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
105
106 LIBEFI=         ${BOOTOBJ}/efi/libefi/libefi.a
107
108 DPADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT}
109 LDADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
110
111 .include <bsd.prog.mk>