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