Makefile.bootprogs revision 1.11
1# $NetBSD: Makefile.bootprogs,v 1.11 1999/04/05 04:38:27 cgd Exp $
2
3S=	${.CURDIR}/../../../..
4
5.PATH:	${.CURDIR}/../common
6
7STRIPFLAG=
8BINMODE= 444
9
10STRIP?=	strip
11
12# XXX Can't do warnings yet.
13WARNS=	0
14
15CHECKSIZE_CMD=	SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
16
17.PHONY: machine-links
18beforedepend: machine-links
19# ${MACHINE} then ${MACHINE_ARCH}
20machine-links:
21	-rm -f machine && \
22	    ln -s $S/arch/alpha/include machine
23	-rm -f alpha && \
24	    ln -s $S/arch/alpha/include alpha
25CLEANFILES+=machine alpha
26
27all: machine-links ${PROG}
28
29AFLAGS+=	-DASSEMBLER
30# -I${.CURDIR}/../.. done by Makefile.inc
31CPPFLAGS+=	-nostdinc -I${.OBJDIR} -D_STANDALONE -I${S}
32CFLAGS=		-Os -mno-fp-regs -g
33
34HAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo 
35.if (${HAVE_GCC28} != "")
36CWARNFLAGS+=	-Wno-main
37.endif
38
39# For descriptions of regions available to bootstrap programs, see
40# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of
41# the Alpha AXP Architecture Reference Manual.
42
43REGION1_START=		0x20000000		# "Region 1 start"
44REGION1_SIZE!=		expr 256 \* 1024	# 256k
45
46# our memory lauout:
47
48#	'unified' boot loaders (e.g. netboot) can consume all of region
49#	1 for their text+data, or text+data+bss.
50
51UNIFIED_LOAD_ADDRESS=	${REGION1_START}
52UNIFIED_MAX_LOAD!=	expr ${REGION1_SIZE}
53UNIFIED_MAX_TOTAL!=	expr ${REGION1_SIZE}
54
55#UNIFIED_HEAP_START=	right after secondary bss
56UNIFIED_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
57
58#	two-stage boot loaders must share region 1.  The first stage
59#	loads into the lowest portion, and uses the higest portion
60#	for its heap.  The second stage loads in between the primary image
61#	and the heap, and can reuse the memory after it (i.e. the primary's
62#	heap) for its own heap.
63
64PRIMARY_LOAD_ADDRESS=	${REGION1_START}
65#PRIMARY_MAX_LOAD=	booter dependent, no more than ${PRIMARY_MAX_TOTAL}
66PRIMARY_MAX_TOTAL!=	expr 16 \* 1024
67
68# XXX SECONDARY_LOAD_ADDRESS should be
69# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy
70# XXX way to do that calculation and 'ld' wants a single number.
71SECONDARY_LOAD_ADDRESS=	0x20004000	# XXX
72SECONDARY_MAX_LOAD!=	expr 112 \* 1024
73SECONDARY_MAX_TOTAL!=	expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL}
74
75PRIMARY_HEAP_START=	(${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD})
76PRIMARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
77
78#SECONDARY_HEAP_START=	right after secondary bss
79SECONDARY_HEAP_LIMIT=	(${REGION1_START} + ${REGION1_SIZE})
80
81FILE_FORMAT_CPPFLAGS=	-DALPHA_BOOT_ECOFF -DALPHA_BOOT_ELF
82
83UNIFIED_CPPFLAGS=	-DUNIFIED_BOOTBLOCK \
84			-DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \
85			${FILE_FORMAT_CPPFLAGS}
86
87PRIMARY_CPPFLAGS=	-DPRIMARY_BOOTBLOCK \
88			-DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \
89			-DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \
90			-DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \
91			-DHEAP_START="${PRIMARY_HEAP_START}"
92
93SECONDARY_CPPFLAGS=	-DSECONDARY_BOOTBLOCK \
94			-DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \
95			${FILE_FORMAT_CPPFLAGS}
96
97.include <bsd.prog.mk>
98
99### find out what to use for libkern
100KERN_AS=	library
101.include "${S}/lib/libkern/Makefile.inc"
102LIBKERN=	${KERNLIB}
103
104### find out what to use for libz
105Z_AS=		library
106.include "${S}/lib/libz/Makefile.inc"
107LIBZ=		${ZLIB}
108
109### find out what to use for libsa
110SA_AS=		library
111.include "${S}/lib/libsa/Makefile.inc"
112LIBSA=		${SALIB}
113