# $NetBSD: Makefile.bootprogs,v 1.1 1998/03/28 00:21:35 thorpej Exp $

.include <bsd.own.mk>			# for ECOFF_TOOLCHAIN definition

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

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

NOMAN=
STRIPFLAG=
BINMODE= 444

STRIP?=	strip

.PHONY: machine-links
beforedepend: machine-links
# ${MACHINE} then ${MACHINE_ARCH}
machine-links:
	-rm -f machine && \
	    ln -s $S/arch/alpha/include machine
	-rm -f alpha && \
	    ln -s $S/arch/alpha/include alpha
CLEANFILES+=machine alpha

all: machine-links ${PROG}

AFLAGS += -DASSEMBLER
#CPPFLAGS+= -nostdinc -I${.OBJDIR}
CPPFLAGS+= -I${.OBJDIR}
CPPFLAGS += -D_STANDALONE -I${.CURDIR}/../.. -I${S}
CFLAGS = -Wall -Werror -mno-fp-regs -g

# For descriptions of regions available to bootstrap programs, see
# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
# the Alpha AXP Architecture Reference Manual.

PRIMARY_LOAD_ADDRESS=	20000000	# "Region 1 start"
SECONDARY_LOAD_ADDRESS=	20004000	# "Region 1 start" + 32k
HEAP_LIMIT=		20040000	# "Region 1 start" + 256k

CPPFLAGS+=		-DPRIMARY_LOAD_ADDRESS="0x${PRIMARY_LOAD_ADDRESS}"
CPPFLAGS+=		-DSECONDARY_LOAD_ADDRESS="0x${SECONDARY_LOAD_ADDRESS}"
CPPFLAGS+=		-DHEAP_LIMIT="0x${HEAP_LIMIT}"

PRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK
FILE_FORMAT_CPPFLAGS=	-DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF

.if defined(ECOFF_TOOLCHAIN)
CPPFLAGS+=	-DECOFF_COMPAT
.endif

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