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