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