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