]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/efi/loader/Makefile
MK_ZFS -> {MK_ZFS|MK_LOADER_ZFS}, this is so we can diable userland / kernel
[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 LOADER?=        loader_${LOADER_INTERP}
12 PROG=           ${LOADER}.sym
13 INTERNALPROG=
14 WARNS?=         3
15
16 # architecture-specific loader code
17 SRCS=   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         smbios.c \
26         vers.c
27
28 CFLAGS+=        -I${.CURDIR}/../loader
29 .if ${MK_LOADER_ZFS} != "no"
30 CFLAGS+=        -I${ZFSSRC}
31 CFLAGS+=        -DEFI_ZFS_BOOT
32 HAVE_ZFS=       yes
33 .endif
34
35 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
36 CWARNFLAGS.self_reloc.c+=       -Wno-error=maybe-uninitialized
37 .endif
38
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
43 # warnings for now.
44 CWARNFLAGS.main.c+=     -Wno-format
45
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"
51
52 CFLAGS+=        -I${.CURDIR}
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
59
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
69 .endif
70 .endif
71
72 .if defined(HAVE_FDT) && ${MK_FDT} != "no"
73 .include        "${BOOTSRC}/fdt.mk"
74 LIBEFI_FDT=     ${BOOTOBJ}/efi/fdt/libefi_fdt.a
75 .endif
76
77 # Include bcache code.
78 HAVE_BCACHE=    yes
79
80 .if defined(EFI_STAGING_SIZE)
81 CFLAGS+=        -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
82 .endif
83
84 NEWVERSWHAT=    "EFI loader" ${MACHINE}
85 VERSION_FILE=   ${.CURDIR}/../loader/version
86
87 # Always add MI sources
88 .include        "${BOOTSRC}/loader.mk"
89
90 FILES+= ${LOADER}.efi
91 FILESMODE_${LOADER}.efi=        ${BINMODE}
92
93 .if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP}
94 LINKS+=         ${BINDIR}/${LOADER}.efi ${BINDIR}/loader.efi
95 .endif
96
97 LDSCRIPT=       ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
98 LDFLAGS+=       -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
99
100 CLEANFILES+=    loader.efi
101
102 ${LOADER}.efi: ${PROG}
103         if ${NM} ${.ALLSRC} | grep ' U '; then \
104                 echo "Undefined symbols in ${.ALLSRC}"; \
105                 exit 1; \
106         fi
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}
113
114 LIBEFI=         ${BOOTOBJ}/efi/libefi/libefi.a
115
116 DPADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT}
117 LDADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA}
118
119 .include <bsd.prog.mk>