Makefile revision 1.15
1#	$NetBSD: Makefile,v 1.15 2005/12/11 12:19:08 christos 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+=	-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_HSFS
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_CREAD=yes
76.include "${S}/lib/libsa/Makefile.inc"
77LIBSA=		${SALIB}
78
79.NOPATH: machine sparc64 sparc
80${SRCS}: machine sparc64 sparc
81
82machine:
83	rm -f machine
84	ln -s sparc64 machine
85
86sparc64:
87	rm -f sparc64
88	ln -s ${.CURDIR}/../../../sparc64/include sparc64
89
90sparc:
91	rm -f sparc
92	ln -s ${.CURDIR}/../../../sparc/include sparc
93
94cleandir distclean: cleanlibdir
95
96cleanlibdir:
97	-rm -rf lib
98
99vers.c: version
100	${HOST_SH} ${S}/conf/newvers_stand.sh ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
101
102.if CROSS
103${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
104	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
105	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
106.else
107${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
108	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
109	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
110.endif
111
112.include <bsd.prog.mk>
113
114.if ${MACHINE_ARCH} == "sparc64"
115AFLAGS+=		-Wa,-Av9a
116CEXTRAFLAGS?=		-D_LP64
117.else
118AFLAGS+=		-Wa,-Av8plusa
119.endif
120
121.if CROSS
122AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
123CEXTRAFLAGS?=		-D_LP64
124.else
125AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
126.endif
127
128NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
129srt0.o: srt0.s
130	${NORMAL_S}
131
132# Explicit dependency for this.
133boot.o: boot.c elfXX_exec.c
134