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