1# $OpenBSD: Makefile,v 1.14 2022/09/02 10:15:35 miod Exp $ 2 3MAN= xxboot.8 4 5.if ${MACHINE} == "landisk" 6PROG= xxboot 7SRCS= pbr.S xxboot.S boot1.c ufs12.c 8LDFLAGS=-nostdlib -Ttext 0x8c201000 -N -x -Bstatic -e start -nopie -znorelro 9 10INSTALL_STRIP= 11 12XXBOOT_SECTORS?= 15 13XXBOOT_MAXSIZE?= (( ${XXBOOT_SECTORS} * 512 )) 14 15CPPFLAGS+=-D_STANDALONE 16CPPFLAGS+=-nostdinc -I${.OBJDIR} -I${.CURDIR}/.. -I${.CURDIR}/../../../.. 17CPPFLAGS+=-DLOADADDRESS=0x8ff00000 -DXXBOOT_SECTORS=${XXBOOT_SECTORS} 18CFLAGS+=-m4-nofpu -fno-pie 19CFLAGS+=-Wall -Wimplicit-function-declaration -Werror 20AFLAGS+= -fno-pie 21 22OBJCOPY?=objcopy 23 24S= ${.CURDIR}/../../../.. 25NO_NET= 26SAREL= 27.include "${S}/lib/libsa/Makefile.inc" 28DPADD+= $(SALIB) 29LDADD+= $(SALIB) 30 31.PATH: ${S}/lib/libkern/arch/sh ${S}/lib/libkern 32SRCS+= strlen.c 33#SRCS+= ashldi3.c ashrdi3.c moddi3.c sdivsi3.S udivsi3.S 34SRCS+= ashldi3.c ashrdi3.c moddi3.c udivsi3.S 35 36${PROG}: ${OBJS} ${DPADD} 37 ${LD} -o ${PROG}.sym ${LDFLAGS} \ 38 -Map ${PROG}.map -cref ${OBJS} ${LDADD} 39 ${OBJCOPY} -O binary ${PROG}.sym ${PROG} 40 @ sz=$$(ls -ln ${PROG} | tr -s ' ' | cut -d' ' -f5); \ 41 if [ "$$sz" -gt "$$${XXBOOT_MAXSIZE}" ]; then \ 42 echo "### ${PROG} size $$sz is larger than ${XXBOOT_MAXSIZE}" >&2 \ 43 rm -f ${PROG}; \ 44 ! :; \ 45 else \ 46 : pad to sector boundary; \ 47 pad=$$(( 512 - ( $$sz & 511 ) )); \ 48 [ $$pad = 512 ] || \ 49 dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \ 50 echo "${PROG} size $$sz, $$((${XXBOOT_MAXSIZE} - $$sz)) free"; \ 51 fi 52.else 53NOPROG= 54.endif 55 56 57.include <bsd.prog.mk> 58