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