1 # $NetBSD: Makefile,v 1.4 2005/12/28 08:04:44 skrll Exp $ 2 3 .include <bsd.own.mk> 4 .include <bsd.sys.mk> # for ${HOST_SH} 5 6 S!= cd ${.CURDIR}/../../../..; pwd 7 8 PROG= boot 9 MKMAN= no # defined 10 STRIPFLAG= 11 BINMODE= 444 12 13 NETBSD_VERS!= ${HOST_SH} ${S}/conf/osrelease.sh 14 15 SRCS= start.S 16 SRCS+= boot.c bootinfo.c conf.c devopen.c disk.c getchar.c getopt.c putchar.c 17 18 # XXX SHOULD NOT NEED TO DEFINE THESE! 19 LIBCRT0= 20 LIBC= 21 LIBCRTBEGIN= 22 LIBCRTEND= 23 24 AFLAGS= -x assembler-with-cpp -traditional-cpp -mno-abicalls -mips2 25 AFLAGS+= -D_LOCORE -D_KERNEL 26 CFLAGS= -Os -mmemcpy -G 1024 27 CFLAGS+= -ffreestanding -mno-abicalls -msoft-float -mips2 28 CFLAGS+= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 29 CPPFLAGS+= -nostdinc -I. -I${S} 30 CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE} 31 CPPFLAGS+= -DLIBSA_USE_MEMSET -DLIBSA_USE_MEMCPY 32 CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 33 #CPPFLAGS+= -DBOOT_DEBUG 34 LDSCRIPT= ${S}/arch/mips/conf/stand.ldscript 35 TEXTADDR= 0x80f00000 36 37 .if !make(obj) && !make(clean) && !make(cleandir) 38 .BEGIN: machine mips 39 .NOPATH: machine mips 40 41 machine:: 42 -rm -f $@ 43 ln -s ${S}/arch/${MACHINE}/include $@ 44 45 mips:: 46 -rm -f $@ 47 ln -s ${S}/arch/mips/include $@ 48 .endif 49 50 CLEANFILES+= machine mips 51 52 # if there is a 'version' file, add rule for vers.c and add it to SRCS 53 # and CLEANFILES 54 .if exists(version) 55 .PHONY: vers.c 56 vers.c: ${.CURDIR}/version 57 ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE} 58 59 SRCS+= vers.c 60 CLEANFILES+= vers.c 61 .endif 62 63 ### find out what to use for libsa 64 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 65 .include "${S}/lib/libsa/Makefile.inc" 66 LIBSA= ${SALIB} 67 68 ### find out what to use for libkern 69 .include "${S}/lib/libkern/Makefile.inc" 70 LIBKERN= ${KERNLIB} 71 72 ### find out what to use for libz 73 .include "${S}/lib/libz/Makefile.inc" 74 LIBZ= ${ZLIB} 75 76 LIBS= ${LIBSA} ${LIBKERN} ${LIBZ} 77 78 cleandir distclean: cleanlibdir 79 cleanlibdir: 80 -rm -rf lib 81 82 ${PROG}: ${OBJS} ${LIBS} 83 ${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \ 84 -e start -o ${PROG}.elf ${OBJS} ${LIBS} 85 @${SIZE} ${PROG}.elf 86 ${OBJCOPY} --impure -O ecoff-littlemips \ 87 -R .pdr -R .mdebug.abi32 -R .comment -R .ident \ 88 ${PROG}.elf ${.TARGET} 89 90 CLEANFILES+= ${PROG}.elf ${PROG}.map 91 92 .include <bsd.prog.mk> 93