xref: /netbsd/sys/arch/sparc/stand/ofwboot/Makefile (revision bf9ec67e)
1#	$NetBSD: Makefile,v 1.5 2001/12/12 01:49:52 tv Exp $
2
3CURDIR=	${.CURDIR}
4S=	${CURDIR}/../../../..
5
6#
7# Override normal settings
8#
9
10WARNS=		0
11
12PROG?=		ofwboot
13SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c
14.PATH:		${S}/arch/sparc64/sparc64
15
16CWARNFLAGS+=	-Wno-main
17CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
18CPPFLAGS+=	-D_STANDALONE -DSUN4U
19CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64
20#CPPFLAGS+=	-DNETIF_DEBUG
21
22NOMAN=		# defined
23STRIPFLAG=
24BINMODE=	444
25
26NEWVERSWHAT=	"OpenFirmware Boot"
27
28#
29# Elf64 defaults to 1MB
30#
31# We may get address conflicts with other bootloaders, say
32# Sun's ufsboot, so we'll pick a reasonably empty address.
33#
34RELOC=		800000
35
36ENTRY=		_start
37
38CLEANFILES+=	vers.c sparc machine
39
40CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
41CPPFLAGS+=	-DRELOC=0x${RELOC}
42
43#
44# XXXXX FIXME
45#
46CPPFLAGS+=	-DSPARC_BOOT_AOUT
47CPPFLAGS+=	-DSPARC_BOOT_ELF
48CPPFLAGS+=	-DSPARC_BOOT_UFS
49CPPFLAGS+=	-DSPARC_BOOT_NFS
50#CPPFLAGS+=	-DSPARC_BOOT_HSFS
51
52### find out what to use for libkern
53KERN_AS=	library
54.include "${S}/lib/libkern/Makefile.inc"
55LIBKERN=	${KERNLIB}
56
57### find out what to use for libz
58Z_AS=		library
59.include "${S}/lib/libz/Makefile.inc"
60LIBZ=		${ZLIB}
61
62### find out what to use for libsa
63SA_AS=		library
64SAMISCMAKEFLAGS= SA_USE_CREAD=yes
65.include "${S}/lib/libsa/Makefile.inc"
66LIBSA=		${SALIB}
67
68.NOPATH: machine sparc64
69${SRCS}: machine sparc64
70
71machine:
72	rm -f machine
73	ln -s sparc64 machine
74
75sparc64:
76	rm -f sparc64
77	ln -s ${.CURDIR}/../../../sparc64/include sparc64
78
79vers.c: version
80	sh ${S}/conf/newvers_stand.sh ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
81
82.if CROSS
83${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
84	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
85	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
86.else
87${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
88	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
89	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
90.endif
91
92.include <bsd.prog.mk>
93
94.if ${MACHINE_ARCH} == "sparc64"
95AFLAGS+=		-Wa,-Av9a
96CEXTRAFLAGS?=		-D_LP64
97.else
98AFLAGS+=		-Wa,-Av8plusa
99.endif
100
101.if CROSS
102AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
103CEXTRAFLAGS?=		-D_LP64
104.else
105AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
106.endif
107
108NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
109srt0.o: srt0.s
110	${NORMAL_S}
111
112# Explicit dependency for this.
113boot.o: boot.c elfXX_exec.c
114