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