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