1 1.52 dholland # $NetBSD: Makefile.booters,v 1.52 2010/05/27 06:58:14 dholland Exp $ 2 1.42 lukem 3 1.42 lukem .include <bsd.sys.mk> # for HOST_SH 4 1.5 mellon 5 1.27 simonb # $S must correspond to the top of the 'sys' tree 6 1.27 simonb S= ${.CURDIR}/../../../.. 7 1.27 simonb 8 1.27 simonb BINMODE?= 444 9 1.41 simonb 10 1.41 simonb # XXX SHOULD NOT NEED TO DEFINE THESE! 11 1.41 simonb LIBCRT0= 12 1.41 simonb LIBC= 13 1.41 simonb LIBCRTBEGIN= 14 1.41 simonb LIBCRTEND= 15 1.34 gmcgarry 16 1.27 simonb .PATH: ${.CURDIR}/../common 17 1.40 jdolecek AFLAGS+= -D_LOCORE -D_KERNEL -mno-abicalls 18 1.27 simonb # -I${.CURDIR}/../.. done by Makefile.inc 19 1.32 simonb CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \ 20 1.32 simonb -I${.OBJDIR} -I${S} 21 1.27 simonb # compiler flags for smallest code size 22 1.39 jdolecek CFLAGS= -ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128 23 1.47 tsutsui CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 24 1.47 tsutsui CFLAGS+= -Werror 25 1.32 simonb LDBUG= -T $S/arch/mips/conf/stand.ldscript 26 1.27 simonb 27 1.42 lukem NETBSD_VERS!= ${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh 28 1.27 simonb CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 29 1.27 simonb 30 1.27 simonb PRIMARY_LOAD_ADDRESS?= 0x80700000 31 1.27 simonb SECONDARY_LOAD_ADDRESS?=0x80710000 32 1.37 jdolecek 33 1.38 simonb NOMAN= # defined 34 1.27 simonb 35 1.27 simonb .if defined(PRIMARY_PROG) 36 1.27 simonb PROG= ${PRIMARY_PROG} 37 1.27 simonb SRCS = start.S bootxx.c callvec.c 38 1.27 simonb SRCS+= devopen.c conf.c rz.c 39 1.27 simonb SRCS+= bootinit.S bootread.S clear_cache.S printf.S 40 1.27 simonb 41 1.27 simonb LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS} 42 1.27 simonb # Pick a number, any number... 43 1.27 simonb PRIMARY_MAX_TOTAL!= expr 16 \* 1024 44 1.27 simonb 45 1.27 simonb CPPFLAGS+= -DPRIMARY_BOOTBLOCK \ 46 1.27 simonb -DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \ 47 1.27 simonb -DNO_GETCHAR \ 48 1.27 simonb -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \ 49 1.27 simonb -DLIBSA_NO_FS_CLOSE \ 50 1.27 simonb -DLIBSA_NO_DEV_CLOSE \ 51 1.48 he -DLIBSA_NO_DEV_IOCTL \ 52 1.27 simonb -DLIBSA_SINGLE_DEVICE=rz \ 53 1.27 simonb -D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \ 54 1.27 simonb -DLIBSA_NO_TWIDDLE \ 55 1.27 simonb -DLIBSA_NO_FD_CHECKING \ 56 1.27 simonb -DLIBSA_NO_RAW_ACCESS \ 57 1.27 simonb -DLIBSA_NO_DISKLABEL_MSGS \ 58 1.49 tsutsui -DALLOC_FIRST_FIT 59 1.27 simonb 60 1.42 lukem CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh 61 1.27 simonb 62 1.27 simonb .elif defined(SECONDARY_PROG) 63 1.27 simonb PROG= ${SECONDARY_PROG} 64 1.27 simonb LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS} 65 1.27 simonb CPPFLAGS+= -DSECONDARY_BOOTBLOCK 66 1.30 jdolecek SRCS+= vers.c 67 1.30 jdolecek CLEANFILES+= vers.c 68 1.27 simonb .else 69 1.27 simonb # XXX ? 70 1.27 simonb .endif 71 1.18 simonb 72 1.27 simonb ### find out what to use for libkern 73 1.27 simonb KERN_AS= library 74 1.27 simonb .include "${S}/lib/libkern/Makefile.inc" 75 1.27 simonb LIBKERN= ${KERNLIB} 76 1.18 simonb 77 1.18 simonb ### find out what to use for libz 78 1.27 simonb .if defined(PRIMARY_PROG) 79 1.27 simonb LIBZ= 80 1.27 simonb .else 81 1.18 simonb Z_AS= library 82 1.18 simonb .include "${S}/lib/libz/Makefile.inc" 83 1.18 simonb LIBZ= ${ZLIB} 84 1.27 simonb .endif 85 1.18 simonb 86 1.27 simonb ### find out what to use for libsa 87 1.27 simonb SA_AS= library 88 1.27 simonb .if defined(PRIMARY_PROG) 89 1.27 simonb SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no 90 1.27 simonb .endif 91 1.27 simonb .if defined(SECONDARY_PROG) 92 1.27 simonb SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes 93 1.33 gmcgarry SAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes 94 1.22 simonb .endif 95 1.27 simonb .include "${S}/lib/libsa/Makefile.inc" 96 1.27 simonb LIBSA= ${SALIB} 97 1.18 simonb 98 1.27 simonb LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} 99 1.36 gmcgarry 100 1.36 gmcgarry .include <bsd.own.mk> 101 1.18 simonb 102 1.30 jdolecek vers.c: ${.CURDIR}/version 103 1.42 lukem ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "pmax" 104 1.18 simonb 105 1.50 tsutsui ${PROG}: ${OBJS} ${LIBS} 106 1.45 simonb ${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \ 107 1.32 simonb ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS} 108 1.27 simonb @${SIZE} ${PROG} 109 1.27 simonb .if defined(CHECKSIZE_CMD) 110 1.27 simonb @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \ 111 1.27 simonb (rm -f ${PROG} ; false) 112 1.33 gmcgarry .endif 113 1.33 gmcgarry .if defined(DO_ECOFF_BINARY) 114 1.33 gmcgarry @echo -n "Creating ECOFF binary... " 115 1.33 gmcgarry @mv ${PROG} ${PROG}.elf 116 1.34 gmcgarry @${ELF2ECOFF} ${PROG}.elf ${PROG} 117 1.33 gmcgarry @echo done. 118 1.27 simonb .endif 119 1.18 simonb 120 1.50 tsutsui .include <bsd.klinks.mk> 121 1.31 tsutsui .include <bsd.prog.mk> 122 1.31 tsutsui 123 1.51 tsutsui CLEANFILES+= ${PROG}.map ${PROG}.elf 124 1.20 simonb 125 1.52 dholland cleandir distclean: .WAIT cleanlibdir 126 1.20 simonb 127 1.20 simonb cleanlibdir: 128 1.44 jmc -rm -rf lib 129