Makefile.bootprogs revision 1.29
1# $NetBSD: Makefile.bootprogs,v 1.29 2009/04/13 12:18:56 tsutsui Exp $ 2 3.include <bsd.sys.mk> # for HOST_SH 4 5S= ${.CURDIR}/../../../.. 6 7.PATH: ${.CURDIR}/../common 8 9STRIPFLAG= 10BINMODE= 444 11 12STRIP?= strip 13 14# XXX SHOULD NOT NEED TO DEFINE THESE! 15LIBCRT0= 16LIBC= 17LIBCRTBEGIN= 18LIBCRTEND= 19 20CHECKSIZE_CMD= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh 21 22realall: ${PROG} 23 24AFLAGS+= -DASSEMBLER 25# -I${.CURDIR}/../.. done by Makefile.inc 26CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 27CFLAGS= -ffreestanding -mno-fp-regs -g 28 29NETBSD_VERS!=${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh 30CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 31 32CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 33CFLAGS+= -Werror ${CWARNFLAGS} 34 35# if there is a 'version' file, add rule for vers.c and add it to SRCS 36# and CLEANFILES 37.if exists(version) 38.PHONY: vers.c 39vers.c: version 40 ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "alpha" 41 42SRCS+= vers.c 43CLEANFILES+= vers.c 44.endif 45 46# For descriptions of regions available to bootstrap programs, see 47# section 3.4.1.2 (pp. III 3-14 - III 3-18) of the second edition of 48# the Alpha AXP Architecture Reference Manual. 49 50REGION1_START= 0x20000000 # "Region 1 start" 51REGION1_SIZE!= expr 256 \* 1024 # 256k 52 53# our memory lauout: 54 55# 'unified' boot loaders (e.g. netboot) can consume all of region 56# 1 for their text+data, or text+data+bss. 57 58UNIFIED_LOAD_ADDRESS= ${REGION1_START} 59UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 60UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 61 62#UNIFIED_HEAP_START= right after secondary bss 63UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 64 65# two-stage boot loaders must share region 1. The first stage 66# loads into the lowest portion, and uses the higest portion 67# for its heap. The second stage loads in between the primary image 68# and the heap, and can reuse the memory after it (i.e. the primary's 69# heap) for its own heap. 70 71PRIMARY_LOAD_ADDRESS= ${REGION1_START} 72#PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 73PRIMARY_MAX_TOTAL!= expr 16 \* 1024 74 75# XXX SECONDARY_LOAD_ADDRESS should be 76# XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 77# XXX way to do that calculation and 'ld' wants a single number. 78SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 79SECONDARY_MAX_LOAD!= expr 112 \* 1024 80SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 81 82PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 83PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 84 85#SECONDARY_HEAP_START= right after secondary bss 86SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 87 88# standalone programs are like kernels. They load at 89# 0xfffffc0000300000 and can use the rest of memory. 90 91STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 92 93 94FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF64 95 96UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 97 -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 98 ${FILE_FORMAT_CPPFLAGS} 99 100PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 101 -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 102 -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 103 -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 104 -DHEAP_START="${PRIMARY_HEAP_START}" 105 106SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 107 -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 108 ${FILE_FORMAT_CPPFLAGS} 109 110STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 111 112.include <bsd.prog.mk> 113.include <bsd.klinks.mk> 114 115COPTS+=-Os # override -O supplied by user 116 117### find out what to use for libkern 118KERN_AS= library 119.include "${S}/lib/libkern/Makefile.inc" 120LIBKERN= ${KERNLIB} 121 122### find out what to use for libz 123Z_AS= library 124.include "${S}/lib/libz/Makefile.inc" 125LIBZ= ${ZLIB} 126 127### find out what to use for libsa 128SA_AS= library 129SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes 130.include "${S}/lib/libsa/Makefile.inc" 131LIBSA= ${SALIB} 132