]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/efi/loader/Makefile
Re-sync loader.mk and ficl.mk to where they should be
[FreeBSD/FreeBSD.git] / sys / boot / efi / loader / Makefile
1 # $FreeBSD$
2
3 MAN=
4
5 LOADER_NET_SUPPORT?=    yes
6 LOADER_MSDOS_SUPPORT?=  yes
7 LOADER_UFS_SUPPORT?=    yes
8 LOADER_CD9660_SUPPORT?= no
9 LOADER_EXT2FS_SUPPORT?= no
10
11 .include <bsd.init.mk>
12
13 MK_SSP=         no
14
15 PROG=           loader.sym
16 INTERNALPROG=
17 WARNS?=         3
18
19 # architecture-specific loader code
20 SRCS=   autoload.c \
21         bootinfo.c \
22         conf.c \
23         copy.c \
24         efi_main.c \
25         framebuffer.c \
26         main.c \
27         self_reloc.c \
28         smbios.c \
29         vers.c
30
31 .if ${MK_ZFS} != "no"
32 LIBZFSBOOT=     ${BOOTOBJ}/zfs/libzfsboot.a
33 CFLAGS+=        -I${ZFSSRC}
34 CFLAGS+=        -DEFI_ZFS_BOOT
35 .endif
36
37 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
38 CWARNFLAGS.self_reloc.c+=       -Wno-error=maybe-uninitialized
39 .endif
40
41 # We implement a slightly non-standard %S in that it always takes a
42 # CHAR16 that's common in UEFI-land instead of a wchar_t. This only
43 # seems to matter on arm64 where wchar_t defaults to an int instead
44 # of a short. There's no good cast to use here so just ignore the
45 # warnings for now.
46 CWARNFLAGS.main.c+=     -Wno-format
47
48 .PATH: ${.CURDIR}/arch/${MACHINE}
49 # For smbios.c
50 .PATH: ${BOOTSRC}/i386/libi386
51 .include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
52
53 CFLAGS+=        -I${.CURDIR}
54 CFLAGS+=        -I${.CURDIR}/arch/${MACHINE}
55 CFLAGS+=        -I${EFISRC}/include
56 CFLAGS+=        -I${EFISRC}/include/${MACHINE}
57 CFLAGS+=        -I${SYSDIR}/contrib/dev/acpica/include
58 CFLAGS+=        -I${BOOTSRC}/i386/libi386
59 CFLAGS+=        -DNO_PCI -DEFI
60
61 # make buildenv doesn't set DESTDIR, this means LIBSTAND
62 # will be wrong when crossbuilding.
63 .if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a)
64 LIBSTAND=       ${.OBJDIR}/../../../../lib/libstand/libstand.a
65 .endif
66
67 .if !defined(BOOT_HIDE_SERIAL_NUMBERS)
68 # Export serial numbers, UUID, and asset tag from loader.
69 CFLAGS+= -DSMBIOS_SERIAL_NUMBERS
70 .if defined(BOOT_LITTLE_ENDIAN_UUID)
71 # Use little-endian UUID format as defined in SMBIOS 2.6.
72 CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID
73 .elif defined(BOOT_NETWORK_ENDIAN_UUID)
74 # Use network-endian UUID format for backward compatibility.
75 CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID
76 .endif
77 .endif
78
79 .if defined(HAVE_FDT) && ${MK_FDT} != "no"
80 .include        "${BOOTSRC}/fdt.mk"
81 LIBEFI_FDT=     ${BOOTOBJ}/efi/fdt/libefi_fdt.a
82 .endif
83
84 # Include bcache code.
85 HAVE_BCACHE=    yes
86
87 .if defined(EFI_STAGING_SIZE)
88 CFLAGS+=        -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
89 .endif
90
91 # Always add MI sources
92 HELP_FILES=
93 .include        "${BOOTSRC}/loader.mk"
94
95 FILES+= loader.efi
96 FILESMODE_loader.efi=   ${BINMODE}
97
98 LDSCRIPT=       ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
99 LDFLAGS+=       -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
100
101 CLEANFILES+=    loader.efi
102
103 NEWVERSWHAT=    "EFI loader" ${MACHINE}
104
105 NM?=            nm
106 OBJCOPY?=       objcopy
107
108 .if ${MACHINE_CPUARCH} == "amd64"
109 EFI_TARGET=     efi-app-x86_64
110 .elif ${MACHINE_CPUARCH} == "i386"
111 EFI_TARGET=     efi-app-ia32
112 .else
113 EFI_TARGET=     binary
114 .endif
115
116 # Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
117 # for build reproducibility.
118 SOURCE_DATE_EPOCH?=1451606400
119 loader.efi: ${PROG}
120         if ${NM} ${.ALLSRC} | grep ' U '; then \
121                 echo "Undefined symbols in ${.ALLSRC}"; \
122                 exit 1; \
123         fi
124         SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
125         ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
126                 -j .dynamic -j .dynsym -j .rel.dyn \
127                 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
128                 -j set_Xficl_compile_set \
129                 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
130
131 LIBEFI=         ${BOOTOBJ}/efi/libefi/libefi.a
132
133 DPADD=          ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \
134                 ${LDSCRIPT}
135 LDADD=          ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}
136
137 .include <bsd.prog.mk>