Makefile revision 1.21
1#	$NetBSD: Makefile,v 1.21 2007/10/17 19:57:16 garbled 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+=	-DRELOC=0x${RELOC}
53
54#
55# XXXXX FIXME
56#
57CPPFLAGS+=	-DSPARC_BOOT_AOUT
58CPPFLAGS+=	-DSPARC_BOOT_ELF
59CPPFLAGS+=	-DSPARC_BOOT_UFS
60CPPFLAGS+=	-DSPARC_BOOT_NFS
61#CPPFLAGS+=	-DSPARC_BOOT_CD9660
62
63### find out what to use for libkern
64KERN_AS=	library
65.include "${S}/lib/libkern/Makefile.inc"
66LIBKERN=	${KERNLIB}
67
68### find out what to use for libz
69Z_AS=		library
70.include "${S}/lib/libz/Makefile.inc"
71LIBZ=		${ZLIB}
72
73### find out what to use for libsa
74SA_AS=		library
75SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
76SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
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
97CLEANFILES+= vers.c
98
99.if CROSS
100${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
101	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
102	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
103.else
104${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
105	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
106	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
107.endif
108
109.include <bsd.prog.mk>
110
111.if ${MACHINE_ARCH} == "sparc64"
112AFLAGS+=		-Wa,-Av9a
113CEXTRAFLAGS?=		-D_LP64
114.else
115AFLAGS+=		-Wa,-Av8plusa
116.endif
117
118.if CROSS
119AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
120CEXTRAFLAGS?=		-D_LP64
121.else
122AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
123.endif
124
125NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
126srt0.o: srt0.s
127	${NORMAL_S}
128
129# Explicit dependency for this.
130boot.o: boot.c
131