blob: 788e721d9581c70bc468f9abe651e8a26aaaba57 (
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
77
78
|
# $OpenBSD: Makefile.common,v 1.16 2019/05/10 21:20:42 mlarkin Exp $
S= ${.CURDIR}/../../../../..
SADIR= ${.CURDIR}/../..
EFIDIR= ${S}/stand/efi
OBJCOPY?= objcopy
OBJDUMP?= objdump
EFI_HEAP_LIMIT= 0xc00000
LDFLAGS+= -nostdlib -T${.CURDIR}/../${LDSCRIPT} -Bsymbolic -shared
COPTS+= -DEFIBOOT -DFWRANDOM -DNEEDS_HEAP_H -I${.CURDIR}/..
COPTS+= -I${EFIDIR}/include -I${S}/stand/boot
COPTS+= -ffreestanding -std=gnu99
COPTS+= -fshort-wchar -fPIC -mno-red-zone
.if ${SOFTRAID:L} == "yes"
COPTS+= -DSOFTRAID
.endif
COPTS+= -D_STANDALONE -nostdinc -fno-builtin
AFLAGS+= -pipe -fPIC
.PATH: ${.CURDIR}/..
SRCS+= self_reloc.c
SRCS+= efiboot.c efidev.c efipxe.c efirng.c
SRCS+= conf.c dev_i386.c cmd_i386.c diskprobe.c exec_i386.c machdep.c
SRCS+= memprobe.c
.PATH: ${S}/stand/boot
SRCS+= boot.c bootarg.c cmd.c vars.c
.PATH: ${S}/lib/libsa
SRCS+= alloc.c ctime.c exit.c getchar.c memcmp.c memcpy.c memmove.c memset.c printf.c \
putchar.c snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c \
strtol.c strtoll.c
SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \
lseek.c open.c read.c readdir.c stat.c
SRCS+= ufs.c cd9660.c
.if ${SOFTRAID:L} == "yes"
SRCS+= aes_xts.c bcrypt_pbkdf.c blowfish.c explicit_bzero.c hmac_sha1.c \
pkcs5_pbkdf2.c rijndael.c sha1.c sha2.c softraid.c
.endif
.PATH: ${S}/lib/libz
SRCS+= adler32.c crc32.c inflate.c inftrees.c
.PATH: ${S}/lib/libkern
SRCS+= divdi3.c moddi3.c qdivrem.c
SRCS+= strlcpy.c
.PATH: ${SADIR}/libsa
SRCS+= loadfile.c elf64.c elf32.c
.if ${SOFTRAID:L} == "yes"
SRCS+= softraid_amd64.c
.endif
PROG.so= ${PROG:S/.EFI/.so/}
CLEANFILES+= ${PROG.so} ${PROG.so}.tmp
${PROG}: ${PROG.so}
${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rel.dyn -j .rela -j .rela.dyn -j .reloc \
--target=${OBJFMT} ${PROG.so} ${.TARGET}
.include <bsd.prog.mk>
CFLAGS+= -Wno-pointer-sign
CPPFLAGS+= -DSMALL -DSLOW -DNOBYFOUR -D__INTERNAL_LIBSA_CREAD
CPPFLAGS+= -DHEAP_LIMIT=${EFI_HEAP_LIMIT} -DHIBERNATE
${PROG.so}: ${OBJS}
${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LDADD}
@if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then \
(echo Undefined symbols; false); \
fi
mv ${.TARGET}.tmp ${.TARGET}
|