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