Makefile revision 1.5
1#	$NetBSD: Makefile,v 1.5 2004/01/07 12:43:44 cdi 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# PRIMARY_LOAD_ADDRESS?=	0x80600000
39LOAD_ADDRESS?=0x81000000
40
41COMPORT?=0x0
42COMBASE?=0xbc800000
43COMSPEED?=115200
44COMPROBE?=0xa020001c
45
46AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
47
48# -I${.CURDIR}/../.. done by Makefile.inc
49CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
50# CPPFLAGS+=	-D_DEBUG
51CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/lib/libsa
52CPPFLAGS+=	-DCONS_SERIAL -DCOMBASE=${COMBASE} -DCOMPORT=${COMPORT}
53CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
54
55# compiler flags for smallest code size
56CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
57OFORMAT=	--oformat elf32-littlemips
58
59NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
60CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
61
62LDSCRIPT?=	${MIPS}/conf/stand.ldscript
63
64PROG=		boot
65# common sources
66SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
67SRCS+=		prf.c com.c cons.c ns16550.c pciide.c wdc.c wd.c
68
69SRCS+=		vers.c
70CLEANFILES+=	vers.c
71
72### find out what to use for libkern
73KERN_AS=	library
74.include "${S}/lib/libkern/Makefile.inc"
75
76### find out what to use for libz
77Z_AS=		library
78.include "${S}/lib/libz/Makefile.inc"
79
80### find out what to use for libsa
81SA_AS=		library
82SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
83.include "${S}/lib/libsa/Makefile.inc"
84
85LIBS=		${KERNLIB} ${SALIB} ${ZLIB}
86
87.PHONY: vers.c
88vers.c: ${.CURDIR}/version
89	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
90
91${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
92	${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
93	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
94	gzip -c9 ${PROG} > ${PROG}.gz
95	@${SIZE} ${PROG}
96
97CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
98
99cleandir distclean: cleanlibdir
100
101cleanlibdir:
102	rm -rf lib
103
104.include <bsd.prog.mk>
105