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