xref: /netbsd-src/sys/arch/sgimips/stand/boot64/Makefile (revision 4bfaffb95bcae73f23ccf80a2eef59030227b4b6)
1#	$NetBSD: Makefile,v 1.15 2024/06/29 08:06:56 rin Exp $
2
3PROG=	ip30boot
4NOMAN=	# defined
5
6SRCS=	start.S boot.c bootinfo.c conf.c devopen.c putchar.c getchar.c \
7	disk.c arcbios_calls.S
8
9
10CLEANFILES+=	boot.map
11
12.include <bsd.init.mk>
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
22.PATH.S:	${S}/dev/arcbios
23AFLAGS+=	-D_LOCORE -D_KERNEL -mno-abicalls -mabi=64 -D_LP64
24CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -I${.OBJDIR} -I${S}
25# compiler flags for smallest code size
26CFLAGS=		-ffreestanding -Os -Wall -Werror -mno-abicalls -msoft-float -G 1024 -mabi=64 -D_LP64
27LDBUG=		-T $S/arch/mips/conf/stand.ldscript
28NETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
29CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
30
31CPPFLAGS+=	-Dsgimips
32
33LDFLAGS+=       -m elf64btsmip
34LINKFORMAT+=    -m elf64btsmip
35
36.include "${S}/dev/arcbios/Makefile.inc"
37
38# We load the kernel at 420K in from the start of RAM to give the boot
39# loader plenty of breathing room.  Load the boot loader starting at
40# the second page of RAM.
41
42LOAD_ADDRESS_IP30?=	0xa800000020080000
43
44### find out what to use for libkern
45KERN_AS=	library
46KERNMISCMAKEFLAGS+=	LD="${LD} -m elf64btsmip" RANLIB="true"
47.include "${S}/lib/libkern/Makefile.inc"
48LIBKERN=	${KERNLIB}
49
50### find out what to use for libz
51Z_AS=		library
52ZMISCMAKEFLAGS+=	LD="${LD} -m elf64btsmip" RANLIB="true"
53.include "${S}/lib/libz/Makefile.inc"
54LIBZ=		${ZLIB}
55
56### find out what to use for libsa
57SA_AS=		library
58SAMISCMAKEFLAGS+=	SA_USE_LOADFILE=yes SA_USE_CREAD=yes \
59			LD="${LD} -m elf64btsmip" RANLIB="true"
60.include "${S}/lib/libsa/Makefile.inc"
61LIBSA=		${SALIB}
62
63
64LIBS=		${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
65
66ip30boot: ${OBJS} ${LIBS}
67	${_MKTARGET_LINK}
68	${LD} -m elf64btsmip -Map boot.map -x -Ttext ${LOAD_ADDRESS_IP30} \
69		${LDBUG} -e start -o ${.TARGET} ${OBJS} ${LIBS}
70	${SIZE} ${.TARGET}
71
72cleandir distclean: .WAIT cleanlibdir
73cleanlibdir:
74	-rm -rf lib
75
76.include "${S}/conf/newvers_stand.mk"
77
78.include <bsd.klinks.mk>
79.include <bsd.prog.mk>
80