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