NetBSD-5.0.2/sys/arch/i386/stand/fatboot/Makefile.fat

#	$NetBSD: Makefile.fat,v 1.3 2008/10/25 22:27:37 apb Exp $

S=		${.CURDIR}/../../../../../

PROG?=		fatboot
NOMAN=		# defined

LIBCRT0=	# nothing
LIBCRTBEGIN=	# nothing
LIBCRTEND=	# nothing
LIBC=		# nothing

PIE_CFLAGS=
PIE_LDFLAGS=
PIE_AFLAGS=

.include <bsd.own.mk>

STRIPFLAG=	# override

SRCS=		fatboot.S

BINDIR=		/usr/mdec
BINMODE=	444

.PATH:		${.CURDIR}/..

LDFLAGS+=	-nostdlib -Wl,-e,start
CPPFLAGS+=	-I. -I${.CURDIR}/../../lib -I${S}
CPPFLAGS+=	-DFAT_ENTRY_SIZE=${FAT_ENTRY_SIZE}

.if ${MACHINE} == "amd64"
LDFLAGS+=	-Wl,-m,elf_i386
AFLAGS+=	-m32
.endif

BUILDSYMLINKS+=	$S/arch/i386/include	machine \
		$S/arch/x86/include	x86

DPSRCS+=	machine x86

CLEANFILES+=	${PROG}.tmp

${PROG}: ${OBJS}
	${_MKTARGET_LINK}
	${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,0x7c00 ${OBJS}
	@ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<pbr_space\>' \
		    | ${TOOL_SED} 's/^0*//'  ); \
		echo "#### There are $$1 free bytes in ${PROG}"
	${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
	rm -f ${PROG}.tmp

.include <bsd.prog.mk>