Makefile revision 1.23
1#	$NetBSD: Makefile,v 1.23 2010/04/02 18:39:44 martin 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
14SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c
15.PATH:		${S}/arch/sparc64/sparc64
16
17# XXX SHOULD NOT NEED TO DEFINE THESE!
18LIBCRT0=
19LIBC=
20LIBCRTBEGIN=
21LIBCRTEND=
22
23COPTS+=		-ffreestanding
24CWARNFLAGS+=	-Wno-main
25CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
26CPPFLAGS+=	-D_STANDALONE -DSUN4U
27CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
28CPPFLAGS+=	-DNETBOOT
29CPPFLAGS+=	-DSUPPORT_DHCP
30#CPPFLAGS+=	-DNETIF_DEBUG 
31#CPPFLAGS+=	-D_DEBUG
32
33LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
34
35NOMAN=		# defined
36STRIPFLAG=
37BINMODE=	444
38
39NEWVERSWHAT=	"OpenFirmware Boot"
40
41#
42# Elf64 defaults to 1MB
43#
44# We may get address conflicts with other bootloaders, say
45# Sun's ufsboot, so we'll pick a reasonably empty address.
46#
47RELOC=		100000
48
49ENTRY=		_start
50
51CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
52CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
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
62CPPFLAGS+=	-DSPARC_BOOT_CD9660
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_LOADFILE=yes SA_USE_CREAD=yes
77SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
78.include "${S}/lib/libsa/Makefile.inc"
79LIBSA=		${SALIB}
80
81.if !make(obj) && !make(clean) && !make(cleandir)
82.BEGIN:
83	@([ -h machine ] || ln -s ${S}/arch/sparc64/include machine)
84	@([ -h sparc64 ] || ln -s ${S}/arch/sparc64/include sparc64)
85	@([ -h sparc ] || ln -s ${S}/arch/sparc/include sparc)
86.NOPATH: machine sparc64 sparc
87.endif
88CLEANFILES+= machine sparc64 sparc
89
90cleandir distclean: cleanlibdir
91
92cleanlibdir:
93	-rm -rf lib
94
95vers.c: version
96	${HOST_SH} ${S}/conf/newvers_stand.sh ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
97
98CLEANFILES+= vers.c
99
100.if CROSS
101${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
102	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
103	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
104.else
105${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
106	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
107	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
108.endif
109
110.include <bsd.prog.mk>
111
112.if ${MACHINE_ARCH} == "sparc64"
113AFLAGS+=		-Wa,-Av9a
114CEXTRAFLAGS?=		-D_LP64
115.else
116AFLAGS+=		-Wa,-Av8plusa
117.endif
118
119.if CROSS
120AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
121CEXTRAFLAGS?=		-D_LP64
122.else
123AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
124.endif
125
126NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
127srt0.o: srt0.s
128	${NORMAL_S}
129
130# Explicit dependency for this.
131boot.o: boot.c
132