Makefile revision 1.13
1#	$NetBSD: Makefile,v 1.13 2008/03/01 17:45:11 tsutsui Exp $
2
3NOMAN= # defined
4
5.include <bsd.own.mk>
6.include <bsd.sys.mk>		# for HOST_SH
7
8S=	${.CURDIR}/../../../..
9MIPS=	${S}/arch/mips
10COBALT=	${S}/arch/cobalt
11LIBSADIR=	${S}/lib/libsa
12
13# .PATH:	${.CURDIR}/../common
14
15BINMODE?= 444
16
17# XXX SHOULD NOT NEED TO DEFINE THESE!
18LIBCRT0=
19LIBC=
20LIBCRTBEGIN=
21LIBCRTEND=
22
23.PHONY:		machine-links
24beforedepend:	machine-links
25
26machine-links:	machine cobalt mips
27machine cobalt:
28	-rm -f ${.TARGET}
29	ln -s ${COBALT}/include ${.TARGET}
30
31mips:
32	-rm -f ${.TARGET}
33	ln -s ${MIPS}/include ${.TARGET}
34
35CLEANFILES+=	machine cobalt mips
36
37realall: machine-links ${PROG}
38
39# Load @15Mb boundary as most (all?) of the Cobalt boxes
40# had been shipped with at least 16Mb.
41#
42# XXX The proper fix is to load at the kernel base address
43# and to relocate itself at the end of available memory.
44LOAD_ADDRESS?=0x80F00000
45
46COMPORT?=0x0
47COMBASE?=0xbc800000
48COMSPEED?=115200
49COMPROBE?=0xa020001c
50
51AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
52
53# -I${.CURDIR}/../.. done by Makefile.inc
54CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
55# CPPFLAGS+=	-D_DEBUG
56CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/arch -I${LIBSADIR}
57CPPFLAGS+=	-DCONS_SERIAL -DCOMBASE=${COMBASE} -DCOMPORT=${COMPORT}
58CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
59CPPFLAGS+=	-DSUPPORT_DHCP -DSUPPORT_BOOTP
60#CPPFLAGS+=	-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
61#CPPFLAGS+=	-DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
62
63# compiler flags for smallest code size
64CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
65
66NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
67CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
68
69LDSCRIPT?=	${MIPS}/conf/stand.ldscript
70
71PROG=		boot
72# common sources
73SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
74SRCS+=		prf.c com.c cons.c ns16550.c pciide.c tgets.c wdc.c wd.c
75SRCS+=		cache.c nif_tlp.c tlp.c
76
77# XXX dev_net.c should really be in libsa, but it doesn't
78#     declare ip_convertaddr correctly.
79.PATH: ${LIBSADIR}
80SRCS+=		dev_net.c
81
82SRCS+=		vers.c
83CLEANFILES+=	vers.c
84
85### find out what to use for libkern
86KERN_AS=	library
87.include "${S}/lib/libkern/Makefile.inc"
88
89### find out what to use for libz
90Z_AS=		library
91.include "${S}/lib/libz/Makefile.inc"
92
93### find out what to use for libsa
94SA_AS=		library
95SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
96.include "${S}/lib/libsa/Makefile.inc"
97
98LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
99
100.PHONY: vers.c
101vers.c: ${.CURDIR}/version
102	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
103
104${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
105	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
106	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
107	gzip -c9 ${PROG} > ${PROG}.gz
108	@${SIZE} ${PROG}
109
110CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
111
112cleandir distclean: cleanlibdir
113
114cleanlibdir:
115	-rm -rf lib
116
117.include <bsd.prog.mk>
118