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