1 # $NetBSD: Makefile,v 1.7 2009/03/15 13:57:57 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 # if there is a 'version' file, add rule for vers.c and add it to SRCS 38 # and CLEANFILES 39 .if exists(version) 40 .PHONY: vers.c 41 vers.c: ${.CURDIR}/version 42 ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE} 43 44 SRCS+= vers.c 45 CLEANFILES+= vers.c 46 .endif 47 48 ### find out what to use for libsa 49 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 50 .include "${S}/lib/libsa/Makefile.inc" 51 LIBSA= ${SALIB} 52 53 ### find out what to use for libkern 54 .include "${S}/lib/libkern/Makefile.inc" 55 LIBKERN= ${KERNLIB} 56 57 ### find out what to use for libz 58 .include "${S}/lib/libz/Makefile.inc" 59 LIBZ= ${ZLIB} 60 61 LIBS= ${LIBSA} ${LIBKERN} ${LIBZ} 62 63 cleandir distclean: cleanlibdir 64 cleanlibdir: 65 -rm -rf lib 66 67 ${PROG}: ${OBJS} ${LIBS} 68 ${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \ 69 -e start -o ${PROG}.elf ${OBJS} ${LIBS} 70 @${SIZE} ${PROG}.elf 71 ${OBJCOPY} --impure -O ecoff-littlemips \ 72 -R .pdr -R .mdebug.abi32 -R .comment -R .ident \ 73 ${PROG}.elf ${.TARGET} 74 75 CLEANFILES+= ${PROG}.elf ${PROG}.map 76 77 .include <bsd.klinks.mk> 78 .include <bsd.prog.mk> 79