1 # $NetBSD: Makefile.mbr,v 1.18 2011/05/20 15:05:02 joerg Exp $
3 S= ${.CURDIR}/../../../../..
27 LDFLAGS+= -nostdlib -Wl,-e,start
28 CPPFLAGS+= -I. -I${.CURDIR}/../../lib -I${S}
30 .if ${MACHINE_ARCH} == "x86_64"
31 LDFLAGS+= -Wl,-m,elf_i386
35 BUILDSYMLINKS+= $S/arch/i386/include machine \
36 $S/arch/x86/include x86
40 CLEANFILES+= ${PROG}.tmp
44 AFLAGS.mbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
45 AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
48 CPPFLAGS+= -DLOADADDR=${LOADADDR}
49 AFLAGS.mbr.S+= -Wa,--divide
52 ${NETBSDSRCDIR}/include/arch/i386/include/stackframe.h machine/stackframe.h \
53 ${NETBSDSRCDIR}/include/arch/i386/include/fpu.h machine/fpu.h
55 DPSRCS+= machine/stackframe.h machine/fpu.h
56 .endif # defined(__MINIX)
61 ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,--section-start=.text=${LOADADDR} ${OBJS}
63 ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}
65 @ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' \
66 | ${TOOL_SED} 's/^0*//' ); \
67 echo "#### There are $$1 free bytes in ${PROG}"
68 ${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
71 .include <bsd.prog.mk>