1 # $NetBSD: Makefile.mbr,v 1.19 2014/01/12 15:26:29 tsutsui Exp $
3 S= ${.CURDIR}/../../../../..
19 .endif # defined(__MINIX)
32 LDFLAGS+= -nostdlib -Wl,-e,start
33 CPPFLAGS+= -I. -I${.CURDIR}/../../lib -I${S}
35 .if ${MACHINE_ARCH} == "x86_64"
36 LDFLAGS+= -Wl,-m,elf_i386
40 BUILDSYMLINKS+= $S/arch/i386/include machine \
41 $S/arch/x86/include x86
45 CLEANFILES+= ${PROG}.tmp
49 AFLAGS.mbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
50 AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
53 CPPFLAGS+= -DLOADADDR=${LOADADDR}
54 .endif # defined(__MINIX)
59 ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,--section-start=.text=${LOADADDR} ${OBJS}
61 ${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}
62 .endif # defined(__MINIX)
63 @ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' \
64 | ${TOOL_SED} 's/^0*//' ); \
65 echo "#### There are $$1 free bytes in ${PROG}"
66 ${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
69 .include <bsd.prog.mk>