Makefile revision 1.19
1#	$NetBSD: Makefile,v 1.19 2009/03/15 10:47:59 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
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
45CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/arch -I${LIBSADIR}
46CPPFLAGS+=	-DCONS_SERIAL -DCOMPORT=${COMPORT}
47CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
48CPPFLAGS+=	-DCONS_ZS -DZSCHAN=${ZSCHAN}
49CPPFLAGS+=	-DZSSPEED=${ZSSPEED} -DZSPROBE=${ZSPROBE}
50CPPFLAGS+=	-DSUPPORT_DHCP -DSUPPORT_BOOTP
51#CPPFLAGS+=	-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
52#CPPFLAGS+=	-DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
53
54# compiler flags for smallest code size
55CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
56
57CFLAGS+=	-Wall -Werror
58CFLAGS+=	-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
59CFLAGS+=	-Wno-pointer-sign
60
61NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
62CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
63
64LDSCRIPT?=	${MIPS}/conf/stand.ldscript
65
66PROG=		boot
67# common sources
68SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
69SRCS+=		prf.c com.c cons.c ns16550.c pciide.c tgets.c wdc.c wd.c
70SRCS+=		zs.c
71SRCS+=		cache.c pci.c nif_tlp.c tlp.c
72SRCS+=		lcd.c
73
74# XXX dev_net.c should really be in libsa, but it doesn't
75#     declare ip_convertaddr correctly.
76.PATH: ${LIBSADIR}
77SRCS+=		dev_net.c
78
79SRCS+=		vers.c
80CLEANFILES+=	vers.c
81
82### find out what to use for libkern
83KERN_AS=	library
84.include "${S}/lib/libkern/Makefile.inc"
85
86### find out what to use for libz
87Z_AS=		library
88.include "${S}/lib/libz/Makefile.inc"
89
90### find out what to use for libsa
91SA_AS=		library
92SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
93.include "${S}/lib/libsa/Makefile.inc"
94
95LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
96
97.PHONY: vers.c
98vers.c: ${.CURDIR}/version
99	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
100
101${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS}
102	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
103	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
104	gzip -c9 ${PROG} > ${PROG}.gz
105	@${SIZE} ${PROG}
106
107CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
108
109cleandir distclean: cleanlibdir
110
111cleanlibdir:
112	-rm -rf lib
113
114.include <bsd.klinks.mk>
115.include <bsd.prog.mk>
116