1# $NetBSD: Makefile.gzboot,v 1.34 2016/03/01 16:08:22 joerg Exp $ 2 3NOMAN= # defined 4 5.include <bsd.init.mk> # Pull in OBJDIR name rules. 6.include <bsd.own.mk> 7.include <bsd.klinks.mk> 8 9EVBARM_STAND= ${S}/arch/evbarm/stand 10 11BASE= gzboot_${PLATFORM}_${RELOC} 12PROGSYM=${BASE}.sym 13PROG= ${BASE}.bin 14WARNS= 1 15 16NEWVERSWHAT= "Gzip Boot" 17VERSIONFILE= ${EVBARM_STAND}/gzboot/version 18 19BINMODE=644 20 21DBG= -Os 22 23# XXX SHOULD NOT NEED TO DEFINE THESE! 24LIBCRT0= 25LIBCRTI= 26LIBC= 27LIBCRTBEGIN= 28LIBCRTEND= 29STRIPFLAG= 30 31.PATH: ${EVBARM_STAND}/gzboot 32.PATH: ${EVBARM_STAND}/board 33 34SRCS+= gzboot.c image.S 35 36STARTFILE= srtbegin.o 37 38CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board 39CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa 40CPPFLAGS+= -I${S}/../common/dist/zlib 41CPPFLAGS+= ${ARM_APCS_FLAGS} 42.if ${HAVE_LLVM:Uno} != "no" || ${HAVE_GCC:U0} >= 48 43CPPFLAGS+= -marm 44.else 45CPPFLAGS+= -mno-thumb -mno-thumb-interwork 46.endif 47 48CPPFLAGS+= -D_STANDALONE 49 50# Specify the heap size (used by board mem_init() routines) 51CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576 # 1M 52 53# libsa options 54CPPFLAGS+= -DHEAP_VARIABLE 55 56CPPFLAGS+= -DRELOC=${RELOC} 57CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE} 58CPPFLAGS+= -DLOADADDR=${LOADADDR} 59 60COPTS+= -ffreestanding 61COPTS+= -fno-stack-protector 62COPTS+= -fno-unwind-tables 63CWARNFLAGS+= -Werror 64CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 65 66CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list 67CLEANFILES+= ${PROGSYM} 68SRCS+= vers.c 69 70### find out what to use for libkern 71KERN_AS= library 72.include "${S}/lib/libkern/Makefile.inc" 73LIBKERN= ${KERNLIB} 74 75### find out what to use for libz 76Z_AS= library 77.include "${S}/lib/libz/Makefile.inc" 78LIBZ= ${ZLIB} 79 80### find out what to use for libsa 81SA_AS= library 82.include "${S}/lib/libsa/Makefile.inc" 83LIBSA= ${SALIB} 84 85cleandir distclean: .WAIT cleanlibdir 86 87cleanlibdir: 88 -rm -rf lib 89 90DIRECT_LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx 91 92LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA} 93 94.PHONY: vers.c 95vers.c: ${VERSIONFILE} 96 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ 97 ${.ALLSRC} '${PLATFORM}' ${NEWVERSWHAT} 98 99${PROG}: ${PROGSYM} 100 ${OBJCOPY} -O binary ${PROGSYM} ${.TARGET} 101 102# Prevent the normal install target from doing anything. 103proginstall:: 104 105# Install the raw binary or the symbol version, based on whether or 106# not the resulting gzboot needs to be mdsetimage'd. 107.if ${MAXIMAGESIZE} == "0" 108FILES= ${PROG} 109.else 110FILES= ${PROGSYM} 111.endif 112 113.include <bsd.prog.mk> 114 115${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 116 ${_MKTARGET_LINK} 117 ${LD} -o ${.TARGET} ${DIRECT_LDFLAGS} ${STARTFILE} \ 118 ${OBJS} ${LIBLIST} > ${BASE}.list 119