1129590Smarius# $NetBSD: Makefile.gzboot,v 1.38 2020/02/12 19:55:32 thorpej Exp $ 2129590Smarius 3129590SmariusNOMAN= # defined 4129590Smarius 5129590Smarius.include <bsd.init.mk> # Pull in OBJDIR name rules. 6129590Smarius.include <bsd.own.mk> 7129590Smarius.include <bsd.klinks.mk> 8129590Smarius 9129590SmariusEVBARM_STAND= ${S}/arch/evbarm/stand 10129590Smarius 11129590SmariusBASE= gzboot_${PLATFORM}_${RELOC} 12129590SmariusPROGSYM=${BASE}.sym 13129590SmariusPROG= ${BASE}.bin 14129590SmariusWARNS= 1 15129590Smarius 16129590SmariusNEWVERSWHAT= "Gzip Boot" 17129590SmariusBINMODE=644 18129590Smarius 19129590SmariusDBG= -Os 20129590Smarius 21129590Smarius# XXX SHOULD NOT NEED TO DEFINE THESE! 22129590SmariusLIBCRT0= 23129590SmariusLIBCRTI= 24129590SmariusLIBC= 25129590SmariusLIBCRTBEGIN= 26129590SmariusLIBCRTEND= 27129590SmariusSTRIPFLAG= 28129590Smarius 29129590Smarius.PATH: ${EVBARM_STAND}/gzboot 30129590Smarius.PATH: ${EVBARM_STAND}/board 31129590Smarius 32129590SmariusSRCS+= gzboot.c image.S 33129590Smarius 34129590SmariusSTARTFILE= srtbegin.o 35 36CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board 37CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa 38CPPFLAGS+= -I${S}/../common/dist/zlib 39CPPFLAGS+= ${ARM_APCS_FLAGS} 40 41CPPFLAGS+= -D_STANDALONE 42 43# Specify the heap size (used by board mem_init() routines) 44CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576 # 1M 45 46# libsa options 47CPPFLAGS+= -DHEAP_VARIABLE 48 49CPPFLAGS+= -DRELOC=${RELOC} 50CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE} 51CPPFLAGS+= -DLOADADDR=${LOADADDR} 52.if defined(GZSRCADDR) 53CPPFLAGS+= -DGZSRCADDR=${GZSRCADDR} 54.endif 55 56COPTS+= -ffreestanding 57COPTS+= -fno-stack-protector 58COPTS+= -fno-unwind-tables 59CWARNFLAGS+= -Werror 60CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 61 62CLEANFILES+= ${STARTFILE} ${BASE}.list 63CLEANFILES+= ${PROGSYM} 64 65### find out what to use for libkern 66KERN_AS= library 67.include "${S}/lib/libkern/Makefile.inc" 68LIBKERN= ${KERNLIB} 69 70### find out what to use for libz 71Z_AS= library 72.include "${S}/lib/libz/Makefile.inc" 73LIBZ= ${ZLIB} 74 75### find out what to use for libsa 76SA_AS= library 77.include "${S}/lib/libsa/Makefile.inc" 78LIBSA= ${SALIB} 79 80cleandir distclean: .WAIT cleanlibdir 81 82cleanlibdir: 83 -rm -rf lib 84 85DIRECT_LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx 86 87LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA} 88 89.include "${S}/conf/newvers_stand.mk" 90 91${PROG}: ${PROGSYM} 92 ${OBJCOPY} -O binary ${PROGSYM} ${.TARGET} 93 94# Prevent the normal install target from doing anything. 95proginstall:: 96 97# Install the raw binary or the symbol version, based on whether or 98# not the resulting gzboot needs to be mdsetimage'd. 99.if ${MAXIMAGESIZE} == "0" 100FILES= ${PROG} 101.else 102FILES= ${PROGSYM} 103.endif 104 105.include <bsd.prog.mk> 106 107${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 108 ${_MKTARGET_LINK} 109 ${LD} -o ${.TARGET} ${DIRECT_LDFLAGS} ${STARTFILE} \ 110 ${OBJS} ${LIBLIST} > ${BASE}.list 111