148 lines
3.4 KiB
Makefile
148 lines
3.4 KiB
Makefile
# $NetBSD: Makefile.booters,v 1.16 2010/05/27 06:58:14 dholland Exp $
|
|
|
|
.include <bsd.sys.mk> # for HOST_SH
|
|
|
|
S= ${.CURDIR}/../../../..
|
|
MIPS= ${S}/arch/mips
|
|
MIPSCO= ${S}/arch/mipsco
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
NOMAN= # defined
|
|
BINMODE?= 444
|
|
|
|
# XXX SHOULD NOT NEED TO DEFINE THESE!
|
|
LIBCRT0=
|
|
LIBC=
|
|
LIBCRTBEGIN=
|
|
LIBCRTEND=
|
|
|
|
.PHONY: machine-links
|
|
beforedepend: machine-links
|
|
|
|
machine-links: machine mipsco mips
|
|
machine mipsco:
|
|
-rm -f ${.TARGET}
|
|
ln -s ${MIPSCO}/include ${.TARGET}
|
|
|
|
mips:
|
|
-rm -f ${.TARGET}
|
|
ln -s ${MIPS}/include ${.TARGET}
|
|
|
|
CLEANFILES+= machine mipsco mips
|
|
|
|
realall: machine-links ${PROG}
|
|
|
|
AFLAGS+= -D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
|
|
# -I${.CURDIR}/../.. done by Makefile.inc
|
|
CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
|
|
CPPFLAGS+= -I${.OBJDIR} -I${S}
|
|
# compiler flags for smallest code size
|
|
#CFLAGS= -Os -mmemcpy -mno-abicalls -G 128
|
|
CFLAGS= -Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
|
|
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
|
|
|
|
NETBSD_VERS!= ${HOST_SH} ${S}/conf/osrelease.sh
|
|
CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
|
|
|
|
PRIMARY_LOAD_ADDRESS?= 0x80600000
|
|
SECONDARY_LOAD_ADDRESS?=0x80610000
|
|
|
|
LDSCRIPT?= ${MIPSCO}/conf/stand.ldscript
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
.if defined(PRIMARY_PROG)
|
|
PROG= ${PRIMARY_PROG}
|
|
SRCS = start.S bootxx.c callvec.c
|
|
SRCS+= devopen.c conf.c saio.c
|
|
SRCS+= prom.S
|
|
|
|
LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
|
|
|
|
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=saio \
|
|
-D"saioioctl(x,y,z)=EINVAL" -D"saioclose(f)=0" \
|
|
-DLIBSA_NO_TWIDDLE \
|
|
-DLIBSA_NO_FD_CHECKING \
|
|
-DLIBSA_NO_DISKLABEL_MSGS \
|
|
-DLIBSA_NO_RAW_ACCESS \
|
|
-DALLOC_FIRST_FIT
|
|
|
|
|
|
CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
|
|
|
|
STRIPSECTIONS?= -R .reginfo -R .mdebug.abi32 -R .comment -R .pdr
|
|
|
|
.elif defined(SECONDARY_PROG)
|
|
PROG= ${SECONDARY_PROG}
|
|
LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS}
|
|
CPPFLAGS+= -DSECONDARY_BOOTBLOCK
|
|
SRCS+= vers.c
|
|
CLEANFILES+= vers.c
|
|
.else
|
|
|
|
.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
|
|
# for now:
|
|
SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
|
|
.endif
|
|
.include "${S}/lib/libsa/Makefile.inc"
|
|
LIBSA= ${SALIB}
|
|
|
|
LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
|
|
|
|
.PHONY: vers.c
|
|
vers.c: ${.CURDIR}/version
|
|
${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "mipsco"
|
|
|
|
${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
|
|
${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
|
|
-T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
|
|
@${SIZE} ${PROG}
|
|
.if defined(PRIMARY_PROG)
|
|
mv ${PROG} ${PROG}.elf
|
|
${OBJCOPY} --strip-all -O ecoff-bigmips ${STRIPSECTIONS} \
|
|
${PROG}.elf ${PROG}
|
|
.endif
|
|
.if defined(CHECKSIZE_CMD)
|
|
@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} || \
|
|
(rm -f ${PROG} ; false)
|
|
.endif
|
|
|
|
CLEANFILES+= ${PROG}.map ${PROG}.elf
|
|
|
|
cleandir distclean: .WAIT cleanlibdir
|
|
|
|
cleanlibdir:
|
|
-rm -rf lib
|
|
|
|
.include <bsd.prog.mk>
|