Makefile revision 1.3
1#	$NetBSD: Makefile,v 1.3 2003/10/26 07:25:36 lukem Exp $
2
3.include <bsd.sys.mk>		# for HOST_SH
4
5S=	${.CURDIR}/../../../..
6MIPS=	${S}/arch/mips
7COBALT=	${S}/arch/cobalt
8PROG=	${BOOTPROG}
9
10# .PATH:	${.CURDIR}/../common
11
12BINMODE?= 444
13
14# XXX SHOULD NOT NEED TO DEFINE THESE!
15LIBCRT0=
16LIBC=
17LIBCRTBEGIN=
18LIBCRTEND=
19
20.PHONY:		machine-links
21beforedepend:	machine-links
22
23machine-links:	machine cobalt mips
24machine cobalt:
25	-rm -f ${.TARGET}
26	ln -s ${COBALT}/include ${.TARGET}
27
28mips:
29	-rm -f ${.TARGET}
30	ln -s ${MIPS}/include ${.TARGET}
31
32CLEANFILES+=	machine cobalt mips
33
34realall: machine-links ${PROG}
35
36# PRIMARY_LOAD_ADDRESS?=	0x80600000
37LOAD_ADDRESS?=0x81000000
38
39COMPORT?=0x0
40COMBASE?=0xbc800000
41COMSPEED?=115200
42COMPROBE?=0xa020001c
43
44AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
45
46# -I${.CURDIR}/../.. done by Makefile.inc
47CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
48# CPPFLAGS+=	-D_DEBUG
49CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/lib/libsa
50CPPFLAGS+=	-DCONS_SERIAL -DCOMBASE=${COMBASE} -DCOMPORT=${COMPORT}
51CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
52
53# compiler flags for smallest code size
54CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
55OFORMAT=	--oformat elf32-littlemips
56
57NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
58CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
59
60LDSCRIPT?=	${MIPS}/conf/stand.ldscript
61
62PROG=		boot
63# common sources
64SRCS+=		start.S boot.c devopen.c conf.c clock.c
65SRCS+=		prf.c com.c cons.c ns16550.c pciide.c wdc.c wd.c
66
67SRCS+=		vers.c
68CLEANFILES+=	vers.c
69
70### find out what to use for libkern
71KERN_AS=	library
72.include "${S}/lib/libkern/Makefile.inc"
73
74### find out what to use for libz
75Z_AS=		library
76.include "${S}/lib/libz/Makefile.inc"
77
78### find out what to use for libsa
79SA_AS=		library
80SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
81.include "${S}/lib/libsa/Makefile.inc"
82
83LIBS=		${KERNLIB} ${SALIB} ${ZLIB} ${KERNLIB}
84
85.PHONY: vers.c
86vers.c: ${.CURDIR}/version
87	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
88
89${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
90	${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
91	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
92	gzip -c9 ${PROG} > ${PROG}.gz
93	@${SIZE} ${PROG}
94
95MAN=
96CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
97
98cleandir distclean: cleanlibdir
99
100cleanlibdir:
101	rm -rf lib
102
103.include <bsd.prog.mk>
104
105/usr/lib/crt0.o:
106	true
107