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