Makefile revision 1.6
1#	$NetBSD: Makefile,v 1.6 2004/01/27 21:03:18 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# 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
61OFORMAT=	--oformat elf32-littlemips
62
63NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
64CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
65
66LDSCRIPT?=	${MIPS}/conf/stand.ldscript
67
68PROG=		boot
69# common sources
70SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
71SRCS+=		prf.c com.c cons.c ns16550.c pciide.c wdc.c wd.c
72
73SRCS+=		vers.c
74CLEANFILES+=	vers.c
75
76### find out what to use for libkern
77KERN_AS=	library
78.include "${S}/lib/libkern/Makefile.inc"
79
80### find out what to use for libz
81Z_AS=		library
82.include "${S}/lib/libz/Makefile.inc"
83
84### find out what to use for libsa
85SA_AS=		library
86SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
87.include "${S}/lib/libsa/Makefile.inc"
88
89LIBS=		${KERNLIB} ${SALIB} ${ZLIB}
90
91.PHONY: vers.c
92vers.c: ${.CURDIR}/version
93	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "cobalt"
94
95${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
96	${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
97	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
98	gzip -c9 ${PROG} > ${PROG}.gz
99	@${SIZE} ${PROG}
100
101CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz
102
103cleandir distclean: cleanlibdir
104
105cleanlibdir:
106	rm -rf lib
107
108.include <bsd.prog.mk>
109