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