xref: /netbsd-src/sys/arch/sgimips/stand/boot64/Makefile (revision d48f14661dda8638fee055ba15d35bdfb29b9fa8)
1#	$NetBSD: Makefile,v 1.3 2005/12/11 12:18:58 christos 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.sys.mk>		# for HOST_SH
11
12# $S must correspond to the top of the 'sys' tree
13S=	${.CURDIR}/../../../..
14
15BINMODE?=	444
16
17realall: ${PROG}
18
19.PATH:		${.CURDIR}/../common
20AFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls -mabi=64 -D_LP64
21CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -I${.OBJDIR} -I${S}
22# compiler flags for smallest code size
23CFLAGS=		-ffreestanding -Os -Wall -Werror -mno-abicalls -msoft-float -G 1024 -mabi=64 -D_LP64
24LDBUG=		-T $S/arch/mips/conf/stand.ldscript
25NETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
26CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
27
28CPPFLAGS+=	-Dsgimips
29
30# PROG set by parent.
31NOMAN=		# defined
32
33# We load the kernel at 420K in from the start of RAM to give the boot
34# loader plenty of breathing room.  Load the boot loader starting at
35# the second page of RAM.
36
37LOAD_ADDRESS_IP30?=	0xa800000020080000
38
39# if there is a 'version' file, add rule for vers.c and add it to SRCS
40# and CLEANFILES
41.if exists(version)
42.PHONY: vers.c
43vers.c: ${.CURDIR}/version
44	${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.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.if !make(obj) && !make(clean) && !make(cleandir)
70.BEGIN:
71	@([ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine)
72	@([ -h mips ] || ln -s ${S}/arch/mips/include mips)
73.NOPATH: machine mips
74.endif
75CLEANFILES+= machine mips
76
77
78LIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
79
80ip30boot: ${OBJS} ${LIBS}
81	${LD} -m elf64btsmip -Map boot.map -x -Ttext ${LOAD_ADDRESS_IP30} \
82		${LDBUG} -e start -o ip30boot ${OBJS} ${LIBS}
83
84.include <bsd.prog.mk>
85