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