Makefile revision 1.38
1#	$NetBSD: Makefile,v 1.38 2017/04/08 19:53:23 christos Exp $
2
3.include <bsd.init.mk>
4
5CURDIR=	${.CURDIR}
6S=	${CURDIR}/../../../..
7
8#
9# Override normal settings
10#
11
12WARNS?=		2
13KLINK_MACHINE=	sparc64
14
15PROG?=		ofwboot
16SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c
17SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
18.if ${MACHINE_ARCH} == "sparc64"
19SRCS+=		hvcall.S
20CPPFLAGS+=	-DSUN4V
21.endif
22.PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
23
24# XXX SHOULD NOT NEED TO DEFINE THESE!
25LIBCRT0=
26LIBCRTI=
27LIBC=
28LIBCRTBEGIN=
29LIBCRTEND=
30
31COPTS+=		-ffreestanding -mcpu=v9
32CWARNFLAGS+=	-Wno-main
33CFLAGS+=	${COPTS}
34CPPFLAGS+=	-D_STANDALONE
35CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
36CPPFLAGS+=	-DNETBOOT
37CPPFLAGS+=	-DSUPPORT_DHCP
38#CPPFLAGS+=	-DNETIF_DEBUG 
39#CPPFLAGS+=	-D_DEBUG
40
41LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
42
43NOMAN=		# defined
44STRIPFLAG=
45BINMODE=	444
46
47NEWVERSWHAT=	"OpenFirmware Boot"
48
49#
50# Elf64 defaults to 1MB
51#
52# We may get address conflicts with other bootloaders, say
53# Sun's ufsboot, so we'll pick a reasonably empty address.
54#
55RELOC=		100000
56
57ENTRY=		_start
58
59CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
60CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
61CPPFLAGS+=	-DRELOC=0x${RELOC}
62
63#
64# XXXXX FIXME
65#
66CPPFLAGS+=	-DSPARC_BOOT_AOUT
67CPPFLAGS+=	-DSPARC_BOOT_ELF
68CPPFLAGS+=	-DSPARC_BOOT_UFS
69CPPFLAGS+=	-DSPARC_BOOT_NFS
70CPPFLAGS+=	-DSPARC_BOOT_CD9660
71
72### find out what to use for libkern
73KERN_AS=	library
74.include "${S}/lib/libkern/Makefile.inc"
75LIBKERN=	${KERNLIB}
76
77### find out what to use for libz
78Z_AS=		library
79.include "${S}/lib/libz/Makefile.inc"
80LIBZ=		${ZLIB}
81
82### find out what to use for libsa
83SA_AS=		library
84SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
85SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
86.include "${S}/lib/libsa/Makefile.inc"
87LIBSA=		${SALIB}
88
89.include "${S}/conf/newvers_stand.mk"
90
91.include <bsd.own.mk>
92.include <bsd.klinks.mk>
93
94.if CROSS
95${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
96	${_MKTARGET_LINK}
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	${_MKTARGET_LINK}
102	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
103	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
104.endif
105
106.include <bsd.prog.mk>
107
108CPUFLAGS+=		-mcpu=v9
109AFLAGS+=		-Wa,-Av9a
110AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
111
112NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
113srt0.o: srt0.s
114	${NORMAL_S}
115
116hvcall.o: hvcall.S
117	${NORMAL_S}
118
119
120# Explicit dependency for this.
121boot.o: boot.c
122