# $NetBSD: Makefile.gzboot,v 1.36 2017/04/08 19:53:20 christos Exp $
NOMAN= # defined
.include <bsd.init.mk> # Pull in OBJDIR name rules.
.include <bsd.own.mk>
.include <bsd.klinks.mk>
EVBARM_STAND= ${S}/arch/evbarm/stand
BASE= gzboot_${PLATFORM}_${RELOC}
PROGSYM=${BASE}.sym
PROG= ${BASE}.bin
WARNS= 1
NEWVERSWHAT= "Gzip Boot"
BINMODE=644
DBG= -Os
# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBCRTI=
LIBC=
LIBCRTBEGIN=
LIBCRTEND=
STRIPFLAG=
.PATH: ${EVBARM_STAND}/gzboot
.PATH: ${EVBARM_STAND}/board
SRCS+= gzboot.c image.S
STARTFILE= srtbegin.o
CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board
CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa
CPPFLAGS+= -I${S}/../common/dist/zlib
CPPFLAGS+= ${ARM_APCS_FLAGS}
CPPFLAGS+= -marm
CPPFLAGS+= -D_STANDALONE
# Specify the heap size (used by board mem_init() routines)
CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576 # 1M
# libsa options
CPPFLAGS+= -DHEAP_VARIABLE
CPPFLAGS+= -DRELOC=${RELOC}
CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
CPPFLAGS+= -DLOADADDR=${LOADADDR}
COPTS+= -ffreestanding
COPTS+= -fno-stack-protector
COPTS+= -fno-unwind-tables
CWARNFLAGS+= -Werror
CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
CLEANFILES+= ${STARTFILE} ${BASE}.list
CLEANFILES+= ${PROGSYM}
### find out what to use for libkern
KERN_AS= library
.include "${S}/lib/libkern/Makefile.inc"
LIBKERN= ${KERNLIB}
### find out what to use for libz
Z_AS= library
.include "${S}/lib/libz/Makefile.inc"
LIBZ= ${ZLIB}
### find out what to use for libsa
SA_AS= library
.include "${S}/lib/libsa/Makefile.inc"
LIBSA= ${SALIB}
cleandir distclean: .WAIT cleanlibdir
cleanlibdir:
-rm -rf lib
DIRECT_LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx
LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
.include "${S}/conf/newvers_stand.mk"
${PROG}: ${PROGSYM}
${OBJCOPY} -O binary ${PROGSYM} ${.TARGET}
# Prevent the normal install target from doing anything.
proginstall::
# Install the raw binary or the symbol version, based on whether or
# not the resulting gzboot needs to be mdsetimage'd.
.if ${MAXIMAGESIZE} == "0"
FILES= ${PROG}
.else
FILES= ${PROGSYM}
.endif
.include <bsd.prog.mk>
${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
${_MKTARGET_LINK}
${LD} -o ${.TARGET} ${DIRECT_LDFLAGS} ${STARTFILE} \
${OBJS} ${LIBLIST} > ${BASE}.list