1 1.7 lukem # $NetBSD: Makefile,v 1.7 2006/06/28 16:24:08 lukem Exp $ 2 1.1 tsutsui 3 1.4 tsutsui WARNS ?= 1 4 1.1 tsutsui NOMAN = 5 1.1 tsutsui 6 1.1 tsutsui BINMODE = 444 7 1.1 tsutsui 8 1.1 tsutsui S = ${.CURDIR}/../../../.. 9 1.1 tsutsui COMMON = ${.CURDIR}/../common 10 1.1 tsutsui 11 1.1 tsutsui LIBSADIR = ${S}/lib/libsa 12 1.1 tsutsui SYSVBFSDIR = ${S}/fs/sysvbfs 13 1.1 tsutsui EWS4800MIPSDIR = ${.CURDIR}/../../ews4800mips 14 1.1 tsutsui DEVDIR = ${.CURDIR}/../../dev 15 1.1 tsutsui 16 1.1 tsutsui .PATH: ${COMMON} ${LIBSADIR} ${SYSVBFSDIR} \ 17 1.1 tsutsui ${EWS4800MIPSDIR} ${SBDDIR} ${DEVDIR} 18 1.1 tsutsui 19 1.1 tsutsui COFFHDRFIX = ${.OBJDIR}/coffhdrfix 20 1.1 tsutsui 21 1.1 tsutsui PROG = boot 22 1.1 tsutsui BOOT_KERNEL = boot_kernel 23 1.3 tsutsui FILES += ${PROG}.coff ${BOOT_KERNEL}.gz # XXX hack to install these 24 1.1 tsutsui SRCS = start.S boot.c prompt.c delay.c cmd.c loader.c 25 1.1 tsutsui SRCS += bfs_subr.o disk.c diskutil.c 26 1.1 tsutsui SRCS += devopen.c datafs.c bootfs.c ustarfs.c 27 1.1 tsutsui SRCS += lance.c ether_if.c 28 1.1 tsutsui SRCS += device_test.c cop0.c mem.c 29 1.1 tsutsui SRCS += boot_device.c floppy_2d.c floppy_2hd_ibmpc.c 30 1.1 tsutsui #SRCS += floppy_2hc.c 31 1.1 tsutsui SRCS += console.c cons_rom.c cons_fb.c cons_zskbd.c cons_zs.c 32 1.1 tsutsui BINKERNEL_C = ${COMMON}/binkernel.c 33 1.1 tsutsui BINKERNEL_SIZE = '2 * 1024 * 1024' 34 1.1 tsutsui BINKERNEL_O = binkernel.o 35 1.1 tsutsui BINKERNEL_DUMMY_O= binkernel_dummy.o 36 1.1 tsutsui 37 1.1 tsutsui # ${S}/lib/libsa 38 1.1 tsutsui SRCS += dev_net.c 39 1.1 tsutsui # ${S}/fs/sysvbfs 40 1.1 tsutsui SRCS += bfs.c 41 1.1 tsutsui # ../../dev 42 1.1 tsutsui SRCS += ga.c 43 1.1 tsutsui # ../../ews4800mips 44 1.1 tsutsui SRCS += pdinfo.c vtoc.c 45 1.1 tsutsui 46 1.1 tsutsui .PHONY: vers.c 47 1.1 tsutsui vers.c: version 48 1.7 lukem ${_MKTARGET_CREATE} 49 1.1 tsutsui ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE} 50 1.1 tsutsui 51 1.1 tsutsui SRCS+= vers.c 52 1.1 tsutsui CLEANFILES+= vers.c 53 1.1 tsutsui 54 1.1 tsutsui TEXTADDR = 0xa0a00000 55 1.5 lukem LINKFLAGS = -T ${S}/arch/mips/conf/stand.ldscript -Ttext ${TEXTADDR} \ 56 1.1 tsutsui -e start -N 57 1.1 tsutsui COFFLDFLAGS = -T ${COMMON}/coffboot.ldscript -N 58 1.1 tsutsui 59 1.1 tsutsui MIPSFLAGS = -mips1 -G 0 -mno-abicalls 60 1.1 tsutsui DEBUGFLAGS = -Wall -Werror 61 1.1 tsutsui DEBUGFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 62 1.1 tsutsui DEBUGFLAGS += -Wno-format-zero-length -Wno-sign-compare 63 1.1 tsutsui OPTFLAGS = -Os -mmemcpy 64 1.1 tsutsui FLAGS = ${MIPSFLAGS} ${DEBUGFLAGS} ${OPTFLAGS} 65 1.1 tsutsui AFLAGS = -xassembler-with-cpp -D_LOCORE ${FLAGS} 66 1.1 tsutsui CFLAGS = ${FLAGS} -ffreestanding 67 1.1 tsutsui 68 1.1 tsutsui CPPFLAGS += -D_STANDALONE -DSUPPORT_BOOTP 69 1.1 tsutsui CPPFLAGS += -nostdinc -I${.OBJDIR} -I${.CURDIR} -I${COMMON} -I${S} 70 1.1 tsutsui CPPFLAGS += -D__daddr_t=int32_t 71 1.4 tsutsui CPPFLAGS += -DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET 72 1.2 tsutsui #CPPFLAGS += -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG 73 1.2 tsutsui #CPPFLAGS += -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID 74 1.1 tsutsui 75 1.1 tsutsui CLEANFILES += ${BINKERNEL_DUMMY_O} ${BINKERNEL_O} 76 1.3 tsutsui CLEANFILES += ${PROG} ${PROG}.elf ${PROG}.coff ${PROG}.tmp ${PROG}.dis 77 1.1 tsutsui CLEANFILES += ${COFFHDRFIX} 78 1.3 tsutsui CLEANFILES += ${BOOT_KERNEL} ${BOOT_KERNEL}.elf ${BOOT_KERNEL}.tmp 79 1.1 tsutsui CLEANFILES += ${BOOT_KERNEL}.gz ${BOOT_KERNEL}.gz.tmp 80 1.1 tsutsui CLEANFILES += machine mips 81 1.1 tsutsui 82 1.1 tsutsui .include "${S}/lib/libkern/Makefile.inc" 83 1.1 tsutsui LIBKERN= ${KERNLIB} 84 1.1 tsutsui 85 1.1 tsutsui .include "${S}/lib/libz/Makefile.inc" 86 1.1 tsutsui LIBZ= ${ZLIB} 87 1.1 tsutsui 88 1.1 tsutsui SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 89 1.1 tsutsui .include "${S}/lib/libsa/Makefile.inc" 90 1.1 tsutsui LIBSA= ${SALIB} 91 1.1 tsutsui 92 1.1 tsutsui LIBS = ${LIBSA} ${LIBZ} ${LIBKERN} 93 1.1 tsutsui 94 1.1 tsutsui # fixup GNU binutils file offset error. 95 1.1 tsutsui coffhdrfix: ${COMMON}/coffhdrfix.c 96 1.1 tsutsui ${HOST_CC} -o ${COFFHDRFIX} ${COMMON}/coffhdrfix.c 97 1.1 tsutsui 98 1.1 tsutsui .if !make(obj) && !make(clean) && !make(cleandir) 99 1.1 tsutsui .BEGIN: 100 1.1 tsutsui @[ -h machine ] || ln -s $S/arch/${MACHINE}/include machine 101 1.1 tsutsui @[ -h mips ] || ln -s $S/arch/mips/include mips 102 1.1 tsutsui .NOPATH: machine mips 103 1.1 tsutsui .endif 104 1.1 tsutsui 105 1.1 tsutsui clean cleandir distclean: cleanlibdir 106 1.1 tsutsui 107 1.1 tsutsui cleanlibdir: 108 1.1 tsutsui -rm -rf lib 109 1.1 tsutsui 110 1.1 tsutsui ${BINKERNEL_DUMMY_O}: ${BINKERNEL_C} 111 1.6 lukem ${_MKTARGET_COMPILE} 112 1.1 tsutsui ${COMPILE.c} -DKERNEL_SIZE=0 ${BINKERNEL_C} -o ${.TARGET} 113 1.1 tsutsui 114 1.1 tsutsui ${BINKERNEL_O}: ${BINKERNEL_C} 115 1.6 lukem ${_MKTARGET_COMPILE} 116 1.2 tsutsui ${COMPILE.c} -DKERNEL_SIZE=${BINKERNEL_SIZE} ${BINKERNEL_C} \ 117 1.2 tsutsui -o ${.TARGET} 118 1.1 tsutsui 119 1.3 tsutsui all realall: ${PROG}.coff ${BOOT_KERNEL}.gz 120 1.1 tsutsui 121 1.1 tsutsui ${PROG}: ${BINKERNEL_DUMMY_O} ${OBJS} ${LIBS} 122 1.6 lukem ${_MKTARGET_LINK} 123 1.5 lukem ${LD} ${LINKFLAGS} -S -o ${PROG}.elf ${OBJS} ${LIBS} \ 124 1.5 lukem ${BINKERNEL_DUMMY_O} 125 1.1 tsutsui ${OBJDUMP} -h ${PROG}.elf 126 1.3 tsutsui # ${OBJDUMP} -m mips:4000 -d ${PROG}.elf > ${PROG}.dis 127 1.1 tsutsui mv ${PROG}.elf ${PROG} 128 1.1 tsutsui ls -al ${PROG} 129 1.1 tsutsui 130 1.2 tsutsui .include <bsd.prog.mk> 131 1.2 tsutsui 132 1.3 tsutsui ${PROG}.coff: ${PROG} 133 1.6 lukem ${_MKTARGET_CREATE} 134 1.3 tsutsui ${ELF2ECOFF} ${PROG} ${.TARGET}.tmp 135 1.3 tsutsui mv ${.TARGET}.tmp ${.TARGET} 136 1.3 tsutsui 137 1.3 tsutsui ${BOOT_KERNEL}.gz: ${BINKERNEL_O} ${OBJS} ${LIBS} 138 1.6 lukem ${_MKTARGET_LINK} 139 1.5 lukem ${LD} ${LINKFLAGS} -o ${BOOT_KERNEL}.elf ${OBJS} ${LIBS} \ 140 1.1 tsutsui ${BINKERNEL_O} 141 1.3 tsutsui mv ${BOOT_KERNEL}.elf ${BOOT_KERNEL} 142 1.3 tsutsui ${OBJDUMP} -h ${BOOT_KERNEL} 143 1.1 tsutsui gzip -9c ${BOOT_KERNEL} > ${.TARGET}.tmp 144 1.1 tsutsui mv ${.TARGET}.tmp ${.TARGET} 145 1.3 tsutsui ls -al ${.TARGET} 146