#	$NetBSD: Makefile.buildboot,v 1.6 2003/12/06 14:04:33 simonb Exp $

S=		${.CURDIR}/../../../..

.PATH: ${.CURDIR}/../common

SRCS=		${COMMONSOURCE} ${DRIVERSOURCE} ${PROGSOURCE} vers.c
NOMAN=		# defined
STRIP=
BINMODE=	444

CLEANFILES+=	${PROG}.sym ${PROG}

CPPFLAGS+=	-I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
CFLAGS=		-O2 -fno-inline -ffreestanding
WARNS?=		2

# no lint here (yet?)
lint:

${PROG}: ${PROG}.sym
	${STRIP} -o ${PROG} ${PROG}.sym

.include <bsd.prog.mk>

### find out what to use for libkern
KERN_AS=	library
.include "${S}/lib/libkern/Makefile.inc"
LIBKERN=	${KERNLIB}

### find out what to use for libz
Z_AS=		library
.include "${S}/lib/libz/Makefile.inc"
LIBZ=		${ZLIB}

### find out what to use for libsa
SA_AS=		library
SAMISCMAKEFLAGS= SA_USE_CREAD=yes
.include "${S}/lib/libsa/Makefile.inc"
LIBSA=		${SALIB}

.PHONY: vers.c
vers.c: version
	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "pc532" ${NEWVERSWHAT}

CHECK!= ${LD} --version 2>&1; :
.if ${CHECK:Minvalid} == ""
RELOCFLAGS!=	echo ${RELOC} | sed -e 's/00$$/20/'
.else
RELOCFLAGS=	-z ${RELOC}
.endif

${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
	${LD} -Ttext ${RELOCFLAGS} -e start -o ${PROG}.sym \
	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
	@${SIZE} ${PROG}.sym
