1 1.49 tsutsui # $NetBSD: Makefile.booters,v 1.49 2009/04/03 10:38:14 tsutsui 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.49 tsutsui -DALLOC_FIRST_FIT 68 1.27 simonb 69 1.42 lukem CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh 70 1.27 simonb 71 1.27 simonb .elif defined(SECONDARY_PROG) 72 1.27 simonb PROG= ${SECONDARY_PROG} 73 1.27 simonb LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS} 74 1.27 simonb CPPFLAGS+= -DSECONDARY_BOOTBLOCK 75 1.30 jdolecek SRCS+= vers.c 76 1.30 jdolecek CLEANFILES+= vers.c 77 1.27 simonb .else 78 1.27 simonb # XXX ? 79 1.27 simonb .endif 80 1.18 simonb 81 1.27 simonb ### find out what to use for libkern 82 1.27 simonb KERN_AS= library 83 1.27 simonb .include "${S}/lib/libkern/Makefile.inc" 84 1.27 simonb LIBKERN= ${KERNLIB} 85 1.18 simonb 86 1.18 simonb ### find out what to use for libz 87 1.27 simonb .if defined(PRIMARY_PROG) 88 1.27 simonb LIBZ= 89 1.27 simonb .else 90 1.18 simonb Z_AS= library 91 1.18 simonb .include "${S}/lib/libz/Makefile.inc" 92 1.18 simonb LIBZ= ${ZLIB} 93 1.27 simonb .endif 94 1.18 simonb 95 1.27 simonb ### find out what to use for libsa 96 1.27 simonb SA_AS= library 97 1.27 simonb .if defined(PRIMARY_PROG) 98 1.27 simonb SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no 99 1.27 simonb .endif 100 1.27 simonb .if defined(SECONDARY_PROG) 101 1.27 simonb SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes 102 1.33 gmcgarry SAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes 103 1.22 simonb .endif 104 1.27 simonb .include "${S}/lib/libsa/Makefile.inc" 105 1.27 simonb LIBSA= ${SALIB} 106 1.18 simonb 107 1.27 simonb LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} 108 1.36 gmcgarry 109 1.36 gmcgarry .include <bsd.own.mk> 110 1.18 simonb 111 1.30 jdolecek vers.c: ${.CURDIR}/version 112 1.42 lukem ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "pmax" 113 1.18 simonb 114 1.30 jdolecek ${PROG}: machine mips pmax ${OBJS} ${LIBS} 115 1.45 simonb ${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \ 116 1.32 simonb ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS} 117 1.27 simonb @${SIZE} ${PROG} 118 1.27 simonb .if defined(CHECKSIZE_CMD) 119 1.27 simonb @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \ 120 1.27 simonb (rm -f ${PROG} ; false) 121 1.33 gmcgarry .endif 122 1.33 gmcgarry .if defined(DO_ECOFF_BINARY) 123 1.33 gmcgarry @echo -n "Creating ECOFF binary... " 124 1.33 gmcgarry @mv ${PROG} ${PROG}.elf 125 1.34 gmcgarry @${ELF2ECOFF} ${PROG}.elf ${PROG} 126 1.33 gmcgarry @echo done. 127 1.27 simonb .endif 128 1.18 simonb 129 1.31 tsutsui .include <bsd.prog.mk> 130 1.31 tsutsui 131 1.27 simonb CLEANFILES+= ${PROG}.map 132 1.20 simonb 133 1.20 simonb cleandir distclean: cleanlibdir 134 1.20 simonb 135 1.20 simonb cleanlibdir: 136 1.44 jmc -rm -rf lib 137