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