Makefile revision 1.11
1#	$NetBSD: Makefile,v 1.11 2006/08/12 11:38:11 uwe 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
11
12# .PATH:	${.CURDIR}/../common
13
14BINMODE?= 444
15
16# XXX SHOULD NOT NEED TO DEFINE THESE!
17LIBCRT0=
18LIBC=
19LIBCRTBEGIN=
20LIBCRTEND=
21
22.PHONY:		machine-links
23beforedepend:	machine-links
24
25machine-links:	machine cobalt mips
26machine cobalt:
27	-rm -f ${.TARGET}
28	ln -s ${COBALT}/include ${.TARGET}
29
30mips:
31	-rm -f ${.TARGET}
32	ln -s ${MIPS}/include ${.TARGET}
33
34CLEANFILES+=	machine cobalt mips
35
36realall: machine-links ${PROG}
37
38# Load @15Mb boundary as most (all?) of the Cobalt boxes
39# had been shipped with at least 16Mb.
40#
41# XXX The proper fix is to load at the kernel base address
42# and to relocate itself at the end of available memory.
43LOAD_ADDRESS?=0x80F00000
44
45COMPORT?=0x0
46COMBASE?=0xbc800000
47COMSPEED?=115200
48COMPROBE?=0xa020001c
49
50AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
51
52# -I${.CURDIR}/../.. done by Makefile.inc
53CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
54# CPPFLAGS+=	-D_DEBUG
55CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/lib/libsa
56CPPFLAGS+=	-DCONS_SERIAL -DCOMBASE=${COMBASE} -DCOMPORT=${COMPORT}
57CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
58
59# compiler flags for smallest code size
60CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
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
71
72SRCS+=		vers.c
73CLEANFILES+=	vers.c
74
75### find out what to use for libkern
76KERN_AS=	library
77.include "${S}/lib/libkern/Makefile.inc"
78
79### find out what to use for libz
80Z_AS=		library
81.include "${S}/lib/libz/Makefile.inc"
82
83### find out what to use for libsa
84SA_AS=		library
85SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
86.include "${S}/lib/libsa/Makefile.inc"
87
88LIBS=		${SALIB} ${ZLIB} ${KERNLIB}
89
90.PHONY: vers.c
91vers.c: ${.CURDIR}/version
92	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
93
94${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
95	${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
96	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
97	gzip -c9 ${PROG} > ${PROG}.gz
98	@${SIZE} ${PROG}
99
100CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
101
102cleandir distclean: cleanlibdir
103
104cleanlibdir:
105	-rm -rf lib
106
107.include <bsd.prog.mk>
108