Makefile revision 1.15
1#	$NetBSD: Makefile,v 1.15 2008/03/02 06:17:41 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
66CFLAGS+=	-Wall -Werror
67CFLAGS+=	-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
68CFLAGS+=	-Wno-pointer-sign
69
70NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
71CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
72
73LDSCRIPT?=	${MIPS}/conf/stand.ldscript
74
75PROG=		boot
76# common sources
77SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
78SRCS+=		prf.c com.c cons.c ns16550.c pciide.c tgets.c wdc.c wd.c
79SRCS+=		cache.c pci.c nif_tlp.c tlp.c
80
81# XXX dev_net.c should really be in libsa, but it doesn't
82#     declare ip_convertaddr correctly.
83.PATH: ${LIBSADIR}
84SRCS+=		dev_net.c
85
86SRCS+=		vers.c
87CLEANFILES+=	vers.c
88
89### find out what to use for libkern
90KERN_AS=	library
91.include "${S}/lib/libkern/Makefile.inc"
92
93### find out what to use for libz
94Z_AS=		library
95.include "${S}/lib/libz/Makefile.inc"
96
97### find out what to use for libsa
98SA_AS=		library
99SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
100.include "${S}/lib/libsa/Makefile.inc"
101
102LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
103
104.PHONY: vers.c
105vers.c: ${.CURDIR}/version
106	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
107
108${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
109	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
110	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
111	gzip -c9 ${PROG} > ${PROG}.gz
112	@${SIZE} ${PROG}
113
114CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
115
116cleandir distclean: cleanlibdir
117
118cleanlibdir:
119	-rm -rf lib
120
121.include <bsd.prog.mk>
122