summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand/boot/Makefile
blob: ed97ba30cb6d0dfb96c56b9a1f0766f9318bafc8 (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
#	$OpenBSD: Makefile,v 1.39 2012/09/25 09:01:03 pascal Exp $

.include "${.CURDIR}/../Makefile.inc"

MAN=	boot.8
MLINKS=	boot.8 boot.conf.5

.if ${MACHINE} == "i386"
S	=${.CURDIR}/../../../..
SADIR=	${.CURDIR}/..

PROG=	boot
LD?=	ld
SIZE?=	size
LDFLAGS+=-nostdlib -Bstatic -nopie

.if defined(DEBUGFLAGS) && !empty(DEBUGFLAGS:M-D_TEST)
CLEANFILES+=	srt0.o
SRCS=	crt0.c
.else
LDFLAGS+=-Ttext $(LINKADDR) -Z -x -noinhibit-exec
CLEANFILES+=	crt0.o
SRCS=	srt0.S
.endif

.PATH:	${S}/stand/boot
SRCS+=	boot.c cmd.c vars.c bootarg.c conf.c

.PATH:	${SADIR}/libsa
SRCS+=	alloca.S debug_i386.S gidt.S
SRCS+=	apmprobe.c bioscons.c biosdev.c cmd_i386.c debug.c dev_i386.c \
	diskprobe.c exec_i386.c gateA20.c machdep.c memprobe.c pciprobe.c \
	ps2probe.c time.c

.PATH:	${S}/lib/libsa
SRCS+=	alloc.c cread.c ctime.c exit.c memcmp.c memcpy.c memset.c printf.c \
	snprintf.c strcmp.c strerror.c strlen.c strncmp.c strncpy.c strtol.c \
	strtoll.c
SRCS+=	close.c closeall.c cons.c dev.c disklabel.c dkcksum.c fstat.c lseek.c \
	open.c read.c readdir.c stat.c
SRCS+=	elf32.c elf64.c loadfile.c
SRCS+=	ufs.c

.PATH:	${S}/lib/libkern
SRCS+=	strlcpy.c

.PATH:	${S}/lib/libkern/arch/i386
SRCS+=	divdi3.c moddi3.c qdivrem.c

.PATH:	${S}/lib/libz
SRCS+=	adler32.c crc32.c inflate.c inftrees.c

boot.bin: boot
	objcopy -v -O binary ${PROG} boot.bin

${PROG}: $(OBJS)
	$(LD) $(LDFLAGS) -o ${PROG} $(OBJS)
	@$(SIZE) ${PROG}

.else
NOPROG=
.endif

.include <bsd.prog.mk>

CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS} -DLINKADDR=${LINKADDR}
CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE
CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} -I${S}/stand/boot #-DCOMPAT_UFS
CFLAGS+=-m32 $(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie
AFLAGS+=-m32 # -Wa,-R
# AFLAGS+=-Wa,-a
AFLAGS+=-fno-pie