1 # $NetBSD: Makefile,v 1.1 2005/04/18 16:27:54 tsutsui 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 .BEGIN: machine mips 38 .NOPATH: machine mips 39 realdepend realall: 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 49 CLEANFILES+= machine mips 50 51 # if there is a 'version' file, add rule for vers.c and add it to SRCS 52 # and CLEANFILES 53 .if exists(version) 54 .PHONY: vers.c 55 vers.c: ${.CURDIR}/version 56 ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE} 57 58 SRCS+= vers.c 59 CLEANFILES+= vers.c 60 .endif 61 62 ### find out what to use for libsa 63 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 64 .include "${S}/lib/libsa/Makefile.inc" 65 LIBSA= ${SALIB} 66 67 ### find out what to use for libkern 68 .include "${S}/lib/libkern/Makefile.inc" 69 LIBKERN= ${KERNLIB} 70 71 ### find out what to use for libz 72 .include "${S}/lib/libz/Makefile.inc" 73 LIBZ= ${ZLIB} 74 75 LIBS= ${LIBSA} ${LIBKERN} ${LIBZ} 76 77 cleandir distclean: cleanlibdir 78 cleanlibdir: 79 -rm -rf lib 80 81 ${PROG}: ${OBJS} ${LIBS} 82 ${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \ 83 -e start -o ${PROG}.elf ${OBJS} ${LIBS} 84 @${SIZE} ${PROG}.elf 85 ${OBJCOPY} --impure -O ecoff-littlemips \ 86 -R .pdr -R .mdebug.abi32 -R .comment -R .ident \ 87 ${PROG}.elf ${.TARGET} 88 89 CLEANFILES+= ${PROG}.elf ${PROG}.map 90 91 .include <bsd.prog.mk> 92