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