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