Makefile revision 1.8
1#	$NetBSD: Makefile,v 1.8 2011/01/22 19:19:23 joerg Exp $
2
3PROG=	ip30boot
4
5SRCS=	start64.S boot.c bootinfo.c conf.c devopen.c putchar.c getchar.c \
6	getopt.c disk.c
7
8CLEANFILES+=	boot.map
9
10.include <bsd.own.mk>
11.include <bsd.sys.mk>		# for HOST_SH
12
13# $S must correspond to the top of the 'sys' tree
14S=	${.CURDIR}/../../../..
15
16BINMODE?=	444
17
18realall: ${PROG}
19
20.PATH:		${.CURDIR}/../common
21AFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls -mabi=64 -D_LP64
22CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -I${.OBJDIR} -I${S}
23# compiler flags for smallest code size
24CFLAGS=		-ffreestanding -Os -Wall -Werror -mno-abicalls -msoft-float -G 1024 -mabi=64 -D_LP64
25LDBUG=		-T $S/arch/mips/conf/stand.ldscript
26NETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
27CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
28
29CPPFLAGS+=	-Dsgimips
30
31# PROG set by parent.
32NOMAN=		# defined
33
34# We load the kernel at 420K in from the start of RAM to give the boot
35# loader plenty of breathing room.  Load the boot loader starting at
36# the second page of RAM.
37
38LOAD_ADDRESS_IP30?=	0xa800000020080000
39
40# if there is a 'version' file, add rule for vers.c and add it to SRCS
41# and CLEANFILES
42.if exists(version)
43.PHONY: vers.c
44vers.c: ${.CURDIR}/version
45	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
46	    ${.CURDIR}/version "sgimips"
47
48SRCS+=	vers.c
49CLEANFILES+= vers.c
50.endif
51
52### find out what to use for libkern
53KERN_AS=	library
54KERNMISCMAKEFLAGS+=	LD="${LD} -m elf64btsmip" RANLIB="true"
55.include "${S}/lib/libkern/Makefile.inc"
56LIBKERN=	${KERNLIB}
57
58### find out what to use for libz
59Z_AS=		library
60ZMISCMAKEFLAGS+=	LD="${LD} -m elf64btsmip" RANLIB="true"
61.include "${S}/lib/libz/Makefile.inc"
62LIBZ=		${ZLIB}
63
64### find out what to use for libsa
65SA_AS=		library
66SAMISCMAKEFLAGS+=	SA_USE_LOADFILE=yes SA_USE_CREAD=yes \
67			LD="${LD} -m elf64btsmip" RANLIB="true"
68.include "${S}/lib/libsa/Makefile.inc"
69LIBSA=		${SALIB}
70
71
72LIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
73
74ip30boot: ${OBJS} ${LIBS}
75	${LD} -m elf64btsmip -Map boot.map -x -Ttext ${LOAD_ADDRESS_IP30} \
76		${LDBUG} -e start -o ${.TARGET} ${OBJS} ${LIBS}
77
78cleandir distclean: .WAIT cleanlibdir
79cleanlibdir:
80	-rm -rf lib
81
82.include <bsd.klinks.mk>
83.include <bsd.prog.mk>
84