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