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