xref: /netbsd-src/sys/arch/cobalt/stand/boot/Makefile (revision b78992537496bc71ee3d761f9fe0be0fc0a9a001)
1#	$NetBSD: Makefile,v 1.18 2008/05/28 14:04:07 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
86SRCS+=		lcd.c
87
88# XXX dev_net.c should really be in libsa, but it doesn't
89#     declare ip_convertaddr correctly.
90.PATH: ${LIBSADIR}
91SRCS+=		dev_net.c
92
93SRCS+=		vers.c
94CLEANFILES+=	vers.c
95
96### find out what to use for libkern
97KERN_AS=	library
98.include "${S}/lib/libkern/Makefile.inc"
99
100### find out what to use for libz
101Z_AS=		library
102.include "${S}/lib/libz/Makefile.inc"
103
104### find out what to use for libsa
105SA_AS=		library
106SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
107.include "${S}/lib/libsa/Makefile.inc"
108
109LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
110
111.PHONY: vers.c
112vers.c: ${.CURDIR}/version
113	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
114
115${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
116	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
117	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
118	gzip -c9 ${PROG} > ${PROG}.gz
119	@${SIZE} ${PROG}
120
121CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
122
123cleandir distclean: cleanlibdir
124
125cleanlibdir:
126	-rm -rf lib
127
128.include <bsd.prog.mk>
129