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