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