# $NetBSD: Makefile.bootprogs,v 1.4 2010/05/27 06:58:14 dholland Exp $

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

NOMAN=		# defined

BINDIR=		/usr/mdec
BINMODE=	0444

PRIMARY_LOAD_ADDRESS?=0x8c201000
SECONDARY_LOAD_ADDRESS?=0x8ff00000

.include <bsd.own.mk>

STRIPFLAG=	# override

LIBCRT0=	# nothing
LIBCRTBEGIN=	# nothing
LIBCRTEND=	# nothing
LIBC=		# nothing

.PATH:	${.CURDIR}/..

COPTS=		-m4-nofpu -Os -ffreestanding

LDFLAGS+=	-N
CFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes
CPPFLAGS+=	-nostdinc -D_STANDALONE
CPPFLAGS+=	-DSH4
CPPFLAGS+=	-I${.OBJDIR} -I${.CURDIR}/.. -I${.CURDIR}/../../boot -I${S}

.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN:
	-rm -f machine && \
	    ln -s ${S}/arch/${MACHINE}/include machine
	-rm -f ${MACHINE_CPU} && \
	    ln -s ${S}/arch/${MACHINE_CPU}/include ${MACHINE_CPU}
.ifdef LIBOBJ
	-rm -f lib && ln -s ${LIBOBJ}/lib lib
	mkdir -p ${LIBOBJ}/lib
.endif
.endif

### find out what to use for libsa
SA_AS= library
.include "${S}/lib/libsa/Makefile.inc"
LIBSA= ${SALIB}
CPPFLAGS+=	-I$(SADIR)

### 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}

cleandir distclean: .WAIT cleanlibdir

cleanlibdir:
	-rm -rf lib
