xref: /netbsd-src/sys/arch/i386/stand/fatboot/Makefile.fat (revision 267197ec1eebfcb9810ea27a89625b6ddf68e3e7)
1#	$NetBSD: Makefile.fat,v 1.1 2007/01/06 20:47:15 dsl Exp $
2
3S=		${.CURDIR}/../../../../../
4
5PROG?=		fatboot
6NOMAN=		# defined
7
8LIBCRT0=	# nothing
9LIBCRTBEGIN=	# nothing
10LIBCRTEND=	# nothing
11LIBC=		# nothing
12
13.include <bsd.own.mk>
14
15STRIPFLAG=	# override
16
17SRCS=		fatboot.S
18
19BINDIR=		/usr/mdec
20BINMODE=	444
21
22.PATH:		${.CURDIR}/..
23
24LDFLAGS+=	-nostdlib -Wl,-e,start
25CPPFLAGS+=	-I. -I${.CURDIR}/../../lib -I${S}
26CPPFLAGS+=	-DFAT_ENTRY_SIZE=${FAT_ENTRY_SIZE}
27
28.if ${MACHINE} == "amd64"
29LDFLAGS+=	-Wl,-m,elf_i386
30AFLAGS+=	-m32
31.endif
32
33BUILDSYMLINKS+=	$S/arch/i386/include	machine \
34		$S/arch/x86/include	x86
35
36DPSRCS+=	machine x86
37
38CLEANFILES+=	${PROG}.tmp
39
40${PROG}: ${OBJS}
41	${_MKTARGET_LINK}
42	${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,0x7c00 ${OBJS}
43	@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<pbr_space\>' \
44		    | sed 's/^0*//'  ); \
45		echo "#### There are $$1 free bytes in ${PROG}"
46	${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
47	rm -f ${PROG}.tmp
48
49.include <bsd.prog.mk>
50