Makefile revision 1.21
1#	$NetBSD: Makefile,v 1.21 2010/05/27 06:58:13 dholland 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
23realall: ${PROG}
24
25# Load @15Mb boundary as most (all?) of the Cobalt boxes
26# had been shipped with at least 16Mb.
27#
28# XXX The proper fix is to load at the kernel base address
29# and to relocate itself at the end of available memory.
30LOAD_ADDRESS?=0x80F00000
31
32COMPORT?=0x0
33COMSPEED?=115200
34COMPROBE?=0xa020001c
35
36ZSCHAN?=0x01		# 0x01: ZS_CHAN_A, 0x00: ZS_CHAN_B
37ZSSPEED?=115200
38ZSPROBE?=0xa020001c
39
40AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
41
42# -I${.CURDIR}/../.. done by Makefile.inc
43CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
44#CPPFLAGS+=	-D_DEBUG	\
45#		-DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPORT
46CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/arch -I${LIBSADIR}
47CPPFLAGS+=	-DCONS_SERIAL -DCOMPORT=${COMPORT}
48CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
49CPPFLAGS+=	-DCONS_ZS -DZSCHAN=${ZSCHAN}
50CPPFLAGS+=	-DZSSPEED=${ZSSPEED} -DZSPROBE=${ZSPROBE}
51CPPFLAGS+=	-DSUPPORT_DHCP -DSUPPORT_BOOTP
52#CPPFLAGS+=	-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
53#CPPFLAGS+=	-DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
54
55# compiler flags for smallest code size
56CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
57
58CFLAGS+=	-Wall -Werror
59CFLAGS+=	-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
60CFLAGS+=	-Wno-pointer-sign
61
62NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
63CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
64
65LDSCRIPT?=	${MIPS}/conf/stand.ldscript
66
67PROG=		boot
68# common sources
69SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
70SRCS+=		prf.c com.c cons.c ns16550.c pciide.c tgets.c wdc.c wd.c
71SRCS+=		zs.c
72SRCS+=		cache.c pci.c nif_tlp.c tlp.c
73SRCS+=		lcd.c
74
75# XXX dev_net.c should really be in libsa, but it doesn't
76#     declare ip_convertaddr correctly.
77.PATH: ${LIBSADIR}
78SRCS+=		dev_net.c
79
80SRCS+=		vers.c
81CLEANFILES+=	vers.c
82
83### find out what to use for libkern
84KERN_AS=	library
85.include "${S}/lib/libkern/Makefile.inc"
86
87### find out what to use for libz
88Z_AS=		library
89.include "${S}/lib/libz/Makefile.inc"
90
91### find out what to use for libsa
92SA_AS=		library
93SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
94.include "${S}/lib/libsa/Makefile.inc"
95
96LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
97
98.PHONY: vers.c
99vers.c: ${.CURDIR}/version
100	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
101
102${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS}
103	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
104	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
105	gzip -c9 ${PROG} > ${PROG}.gz
106	@${SIZE} ${PROG}
107
108CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
109
110cleandir distclean: .WAIT cleanlibdir
111
112cleanlibdir:
113	-rm -rf lib
114
115.include <bsd.klinks.mk>
116.include <bsd.prog.mk>
117