1#	$NetBSD: src/sys/arch/shark/stand/ofwboot/Makefile,v 1.11 2009-01-12 07:32:32 tsutsui Exp $
2
3.include <bsd.own.mk>
4
5S=		${.CURDIR}/../../../..
6
7WARNS=		2
8PROG=		ofwboot
9SRCS=		srt0.S Locore.c alloc.c boot.c ofdev.c net.c netif_of.c vers.c
10CFLAGS+=	-ffreestanding -Wno-main
11#CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
12CPPFLAGS+=	-DSUPPORT_DHCP -I${.CURDIR}
13CPPFLAGS+=	-D_STANDALONE
14DBG=		-Os
15
16SRCS+=		byteorder.c
17.PATH:		${S}/lib/libsa
18
19# XXX SHOULD NOT NEED TO DEFINE THESE!
20LIBCRT0=
21LIBC=
22LIBCRTBEGIN=
23LIBCRTEND=
24
25NOMAN=		# defined
26STRIPFLAG=
27BINMODE=	444
28
29NEWVERSWHAT=	"OpenFirmware Boot"
30
31RELOC=		f0000000
32
33ENTRY=		_start
34
35CLEANFILES+=	vers.c
36
37CPPFLAGS+=	-nostdinc -I. -I${.CURDIR}/../../.. -I${S}
38CPPFLAGS+=	-DRELOC=0x${RELOC}
39
40.if !make(obj) && !make(clean) && !make(cleandir)
41.BEGIN:
42	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
43	@[ -h arm ] || ln -s ${S}/arch/arm/include arm
44.endif
45
46.NOPATH: machine arm
47CLEANFILES+= machine arm
48
49CLEANFILES+= ${PROG}.aout
50
51### find out what to use for libkern
52KERN_AS=	library
53.include "${S}/lib/libkern/Makefile.inc"
54LIBKERN=	${KERNLIB}
55
56### find out what to use for libz
57Z_AS=		library
58.include "${S}/lib/libz/Makefile.inc"
59LIBZ=		${ZLIB}
60
61### find out what to use for libsa
62SA_AS=		library
63SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
64.include "${S}/lib/libsa/Makefile.inc"
65LIBSA=		${SALIB}
66
67.PHONY: vers.c
68vers.c: version
69	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
70	    ${.CURDIR}/version "shark" ${NEWVERSWHAT}
71
72${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
73	${LD} -s -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${.TARGET}.aout \
74	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
75	${OBJCOPY} -O binary ${.TARGET}.aout ${.TARGET}
76
77.include <bsd.prog.mk>
78