Makefile revision 1.2
1# $NetBSD: Makefile,v 1.2 2005/05/11 16:55:31 jmc 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.BEGIN: machine mips
38.NOPATH: machine mips
39
40machine::
41	-rm -f $@
42	ln -s ${S}/arch/${MACHINE}/include $@
43
44mips::
45	-rm -f $@
46	ln -s ${S}/arch/mips/include $@
47
48CLEANFILES+= 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
54vers.c: ${.CURDIR}/version
55	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE}
56
57SRCS+=	vers.c
58CLEANFILES+= vers.c
59.endif
60
61### find out what to use for libsa
62SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
63.include "${S}/lib/libsa/Makefile.inc"
64LIBSA=   ${SALIB}
65
66### find out what to use for libkern
67.include "${S}/lib/libkern/Makefile.inc"
68LIBKERN= ${KERNLIB}
69
70### find out what to use for libz
71.include "${S}/lib/libz/Makefile.inc"
72LIBZ=    ${ZLIB}
73
74LIBS=  ${LIBSA} ${LIBKERN} ${LIBZ}
75
76cleandir distclean: cleanlibdir
77cleanlibdir:
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
88CLEANFILES+=	${PROG}.elf ${PROG}.map
89
90.include <bsd.prog.mk>
91