]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/efi/loader/Makefile
Update svn-1.9.7 to 1.10.0.
[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_ZFS} != "no"
28 LIBZFSBOOT=     ${BOOTOBJ}/zfs/libzfsboot.a
29 CFLAGS+=        -I${ZFSSRC}
30 CFLAGS+=        -DEFI_ZFS_BOOT
31 HAVE_ZFS=       yes
32 .endif
33
34 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201
35 CWARNFLAGS.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.
43 CWARNFLAGS.main.c+=     -Wno-format
44
45 .PATH: ${.CURDIR}/arch/${MACHINE}
46 # For smbios.c
47 .PATH: ${BOOTSRC}/i386/libi386
48 .include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
49
50 CFLAGS+=        -I${.CURDIR}
51 CFLAGS+=        -I${.CURDIR}/arch/${MACHINE}
52 CFLAGS+=        -I${EFISRC}/include
53 CFLAGS+=        -I${EFISRC}/include/${MACHINE}
54 CFLAGS+=        -I${SYSDIR}/contrib/dev/acpica/include
55 CFLAGS+=        -I${BOOTSRC}/i386/libi386
56 CFLAGS+=        -DNO_PCI -DEFI
57
58 .if !defined(BOOT_HIDE_SERIAL_NUMBERS)
59 # Export serial numbers, UUID, and asset tag from loader.
60 CFLAGS+= -DSMBIOS_SERIAL_NUMBERS
61 .if defined(BOOT_LITTLE_ENDIAN_UUID)
62 # Use little-endian UUID format as defined in SMBIOS 2.6.
63 CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID
64 .elif defined(BOOT_NETWORK_ENDIAN_UUID)
65 # Use network-endian UUID format for backward compatibility.
66 CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID
67 .endif
68 .endif
69
70 .if defined(HAVE_FDT) && ${MK_FDT} != "no"
71 .include        "${BOOTSRC}/fdt.mk"
72 LIBEFI_FDT=     ${BOOTOBJ}/efi/fdt/libefi_fdt.a
73 .endif
74
75 # Include bcache code.
76 HAVE_BCACHE=    yes
77
78 .if defined(EFI_STAGING_SIZE)
79 CFLAGS+=        -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
80 .endif
81
82 # Always add MI sources
83 .include        "${BOOTSRC}/loader.mk"
84
85 FILES+= loader.efi
86 FILESMODE_loader.efi=   ${BINMODE}
87
88 LDSCRIPT=       ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
89 LDFLAGS+=       -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared
90
91 CLEANFILES+=    loader.efi
92
93 NEWVERSWHAT=    "EFI loader" ${MACHINE}
94
95 NM?=            nm
96 OBJCOPY?=       objcopy
97
98 .if ${MACHINE_CPUARCH} == "amd64"
99 EFI_TARGET=     efi-app-x86_64
100 .elif ${MACHINE_CPUARCH} == "i386"
101 EFI_TARGET=     efi-app-ia32
102 .else
103 EFI_TARGET=     binary
104 .endif
105
106 # Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
107 # for build reproducibility.
108 SOURCE_DATE_EPOCH?=1451606400
109 loader.efi: ${PROG}
110         if ${NM} ${.ALLSRC} | grep ' U '; then \
111                 echo "Undefined symbols in ${.ALLSRC}"; \
112                 exit 1; \
113         fi
114         SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
115         ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
116                 -j .dynamic -j .dynsym -j .rel.dyn \
117                 -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
118                 -j set_Xficl_compile_set \
119                 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
120
121 LIBEFI=         ${BOOTOBJ}/efi/libefi/libefi.a
122
123 DPADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \
124                 ${LDSCRIPT}
125 LDADD=          ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}
126
127 .include <bsd.prog.mk>