summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/efi/Makefile
blob: 95c219d3c257cfadf11aab3bc3e2781b5ab7c9bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# $FreeBSD$

NO_MAN=
WITHOUT_SSP=
BUILDING_EFI=

.include <bsd.own.mk>

PROG=		loader.sym
INTERNALPROG=

# architecture-specific loader code
SRCS=	main.c exec.c conf.c vers.c reloc.c start.S elf32_freebsd.c
SRCS+=	i386_copy.c bootinfo.c autoload.c devicename.c efimd.c

CFLAGS+=	-I${.CURDIR}/../../efi/include
CFLAGS+=	-I${.CURDIR}/../../efi/include/i386

.if ${MK_FORTH} != "no"
BOOT_FORTH=	yes
CFLAGS+=	-DBOOT_FORTH
CFLAGS+=	-I${.CURDIR}/../../ficl
CFLAGS+=	-I${.CURDIR}/../../ficl/i386
LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
.endif

# Include bcache code.
HAVE_BCACHE=    yes

# Always add MI sources 
.PATH:		${.CURDIR}/../../common
.include	"${.CURDIR}/../../common/Makefile.inc"
CFLAGS+=	-I${.CURDIR}/../../common

FILES=	loader.efi
FILESMODE_loader.efi=	${BINMODE}

LDSCRIPT=	${.CURDIR}/ldscript.i386
LDFLAGS=	-Wl,-T${LDSCRIPT} -shared -symbolic

${PROG}:	${LDSCRIPT}

CLEANFILES=	vers.c loader.efi

NEWVERSWHAT=	"EFI loader" x86

vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}

OBJCOPY?=	objcopy
OBJDUMP?=	objdump

loader.efi: loader.sym
	if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
		${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
		exit 1; \
	fi
	${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \
	    -j .rel.dyn -j .reloc -j .sdata -j .text -j set_Xcommand_set \
	    --target=efi-app-ia32 ${.ALLSRC} ${.TARGET}

LIBEFI=		${.OBJDIR}/../../efi/libefi/libefi.a
CFLAGS+=	-I${.CURDIR}/../libi386
CFLAGS+=	-I${.CURDIR}/../btx/lib

DPADD=		${LIBFICL} ${LIBEFI} ${LIBSTAND}
LDADD=		${LIBFICL} ${LIBEFI} ${LIBSTAND}

.include <bsd.prog.mk>

.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+=        -I.
beforedepend ${OBJS}: machine
machine:
	ln -sf ${.CURDIR}/../../../i386/include machine
.endif
OpenPOWER on IntegriCloud