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