Makefile revision 1.7
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
6S!= cd ${.CURDIR}/../../../..; pwd
7
8PROG= boot
9MKMAN= no		# defined
10STRIPFLAG=
11BINMODE= 444
12
13NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
14
15SRCS=	start.S
16SRCS+=	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!
19LIBCRT0=
20LIBC=
21LIBCRTBEGIN=
22LIBCRTEND=
23
24AFLAGS=    -x assembler-with-cpp -traditional-cpp -mno-abicalls -mips2
25AFLAGS+=   -D_LOCORE -D_KERNEL
26CFLAGS=    -Os -mmemcpy -G 1024
27CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2
28CFLAGS+=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
29CPPFLAGS+= -nostdinc -I. -I${S}
30CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE}
31CPPFLAGS+= -DLIBSA_USE_MEMSET -DLIBSA_USE_MEMCPY
32CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
33#CPPFLAGS+= -DBOOT_DEBUG
34LDSCRIPT=  ${S}/arch/mips/conf/stand.ldscript
35TEXTADDR=  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
41vers.c: ${.CURDIR}/version
42	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE}
43
44SRCS+=	vers.c
45CLEANFILES+= vers.c
46.endif
47
48### find out what to use for libsa
49SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
50.include "${S}/lib/libsa/Makefile.inc"
51LIBSA=   ${SALIB}
52
53### find out what to use for libkern
54.include "${S}/lib/libkern/Makefile.inc"
55LIBKERN= ${KERNLIB}
56
57### find out what to use for libz
58.include "${S}/lib/libz/Makefile.inc"
59LIBZ=    ${ZLIB}
60
61LIBS=  ${LIBSA} ${LIBKERN} ${LIBZ}
62
63cleandir distclean: cleanlibdir
64cleanlibdir:
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
75CLEANFILES+=	${PROG}.elf ${PROG}.map
76
77.include <bsd.klinks.mk>
78.include <bsd.prog.mk>
79