NetBSD/sys/arch/pmax/stand/Makefile.booters

135 lines
3.3 KiB
Makefile

# $NetBSD: Makefile.booters,v 1.57 2011/07/10 08:42:55 mrg Exp $
NOMAN= # defined
.include <bsd.own.mk>
.include <bsd.sys.mk> # for HOST_SH
# $S must correspond to the top of the 'sys' tree
S= ${.CURDIR}/../../../..
BINMODE?= 444
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
.PATH: ${.CURDIR}/../common
AFLAGS+= -D_LOCORE -D_KERNEL -mno-abicalls
# -I${.CURDIR}/../.. done by Makefile.inc
CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
-I${.OBJDIR} -I${S}
# compiler flags for smallest code size
CFLAGS= -ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
CFLAGS+= -Werror
LDBUG= -T $S/arch/mips/conf/stand.ldscript
.if ${MACHINE_ARCH} == "mips64el"
AFLAGS+= -mips3 -mabi=32
CFLAGS+= -mips3 -mabi=32
LDBUG+= -m elf32ltsmip
.endif
NETBSD_VERS!= ${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
PRIMARY_LOAD_ADDRESS?= 0x80700000
SECONDARY_LOAD_ADDRESS?=0x80710000
.if defined(PRIMARY_PROG)
PROG= ${PRIMARY_PROG}
SRCS = start.S bootxx.c callvec.c
SRCS+= devopen.c conf.c rz.c
SRCS+= bootinit.S bootread.S clear_cache.S printf.S
LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
# Pick a number, any number...
PRIMARY_MAX_TOTAL!= expr 16 \* 1024
CPPFLAGS+= -DPRIMARY_BOOTBLOCK \
-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
-DNO_GETCHAR \
-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
-DLIBSA_NO_FS_CLOSE \
-DLIBSA_NO_DEV_CLOSE \
-DLIBSA_NO_DEV_IOCTL \
-DLIBSA_SINGLE_DEVICE=rz \
-D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
-DLIBSA_NO_TWIDDLE \
-DLIBSA_NO_FD_CHECKING \
-DLIBSA_NO_RAW_ACCESS \
-DLIBSA_NO_DISKLABEL_MSGS \
-DALLOC_FIRST_FIT
CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
.elif defined(SECONDARY_PROG)
PROG= ${SECONDARY_PROG}
LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS}
CPPFLAGS+= -DSECONDARY_BOOTBLOCK
SRCS+= vers.c
CLEANFILES+= vers.c
.else
# XXX ?
.endif
### 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
.if defined(PRIMARY_PROG)
LIBZ=
.else
Z_AS= library
.include "${S}/lib/libz/Makefile.inc"
LIBZ= ${ZLIB}
.endif
### find out what to use for libsa
SA_AS= library
.if defined(PRIMARY_PROG)
SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
.endif
.if defined(SECONDARY_PROG)
SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
SAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
.endif
.include "${S}/lib/libsa/Makefile.inc"
LIBSA= ${SALIB}
LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
vers.c: ${.CURDIR}/version
${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
-N ${.CURDIR}/version "pmax"
${PROG}: ${OBJS} ${LIBS}
${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
@${SIZE} ${PROG}
.if defined(CHECKSIZE_CMD)
@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
(rm -f ${PROG} ; false)
.endif
.if defined(DO_ECOFF_BINARY)
@echo -n "Creating ECOFF binary... "
@mv ${PROG} ${PROG}.elf
@${ELF2ECOFF} ${PROG}.elf ${PROG}
@echo done.
.endif
.include <bsd.klinks.mk>
.include <bsd.prog.mk>
CLEANFILES+= ${PROG}.map ${PROG}.elf
cleandir distclean: .WAIT cleanlibdir
cleanlibdir:
-rm -rf lib