1# $FreeBSD$
2
3.include <bsd.init.mk>
4
5LIB=	efi
6WARNS?=	2
7
8SRCS=	delay.c \
9	devicename.c \
10	devpath.c \
11	efi_console.c \
12	efi_driver_utils.c \
13	efichar.c \
14	efienv.c \
15	efihttp.c \
16	efinet.c \
17	efipart.c \
18	efizfs.c \
19	env.c \
20	errno.c \
21	handles.c \
22	libefi.c \
23	wchar.c
24
25.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
26SRCS+=	time.c
27.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm"
28SRCS+=	time_event.c
29.endif
30
31# We implement a slightly non-standard %S in that it always takes a
32# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
33# seems to matter on arm64 where wchar_t defaults to an int instead
34# of a short. There's no good cast to use here so just ignore the
35# warnings for now.
36CWARNFLAGS.efinet.c+=	-Wno-format
37CWARNFLAGS.efipart.c+=	-Wno-format
38CWARNFLAGS.env.c+=	-Wno-format
39
40.if ${MACHINE_CPUARCH} == "aarch64"
41CFLAGS+=	-mgeneral-regs-only
42.endif
43.if ${MACHINE_ARCH} == "amd64"
44CFLAGS+= -fPIC -mno-red-zone
45.endif
46CFLAGS+= -I${EFIINC}
47CFLAGS+= -I${EFIINCMD}
48.if ${MK_LOADER_ZFS} != "no"
49CFLAGS+=	-I${ZFSSRC}
50CFLAGS+=	-DEFI_ZFS_BOOT
51.endif
52
53# Pick up the bootstrap header for some interface items
54CFLAGS+= -I${LDRSRC}
55
56# Handle FreeBSD specific %b and %D printf format specifiers
57CFLAGS+= ${FORMAT_EXTENSIONS}
58
59# Do not use TERM_EMU on arm and arm64 as it doesn't behave well with serial console
60.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "aarch64"
61CFLAGS+= -DTERM_EMU
62.endif
63
64.include <bsd.lib.mk>
65