Home | History | Annotate | Line # | Download | only in gzboot
Makefile.gzboot revision 1.22
      1 #	$NetBSD: Makefile.gzboot,v 1.22 2013/02/06 07:19:19 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 
     40 CPPFLAGS+= -D_STANDALONE
     41 
     42 # Specify the heap size (used by board mem_init() routines)
     43 CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576		# 1M
     44 
     45 # libsa options
     46 CPPFLAGS+= -DHEAP_VARIABLE
     47 
     48 CPPFLAGS+= -DRELOC=${RELOC}
     49 CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
     50 CPPFLAGS+= -DLOADADDR=${LOADADDR}
     51 
     52 COPTS+=	-ffreestanding
     53 COPTS+=	-fno-stack-protector
     54 CWARNFLAGS+= -Werror
     55 CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
     56 
     57 CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
     58 CLEANFILES+= ${PROGSYM}
     59 SRCS+= vers.c
     60 
     61 .if !make(obj) && !make(clean) && !make(cleandir)
     62 .NOPATH: machine
     63 .endif
     64 
     65 realdepend realall: machine
     66 CLEANFILES+= arm machine
     67 
     68 machine::
     69 	-rm -f arm machine
     70 	ln -s ${S}/arch/evbarm/include machine
     71 	ln -s ${S}/arch/arm/include arm
     72 
     73 ${OBJS}: machine
     74 
     75 ### find out what to use for libkern
     76 KERN_AS=	library
     77 .include "${S}/lib/libkern/Makefile.inc"
     78 LIBKERN=	${KERNLIB}
     79 
     80 ### find out what to use for libz
     81 Z_AS=		library
     82 .include "${S}/lib/libz/Makefile.inc"
     83 LIBZ=		${ZLIB}
     84 
     85 ### find out what to use for libsa
     86 SA_AS=		library
     87 .include "${S}/lib/libsa/Makefile.inc"
     88 LIBSA=		${SALIB}
     89 
     90 cleandir distclean: .WAIT cleanlibdir
     91 
     92 cleanlibdir:
     93 	-rm -rf lib
     94 
     95 LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx
     96 
     97 LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
     98 
     99 .PHONY: vers.c
    100 vers.c: ${VERSIONFILE}
    101 	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
    102 	    ${.ALLSRC} '${PLATFORM}' ${NEWVERSWHAT}
    103 
    104 ${PROG}: ${PROGSYM}
    105 	${OBJCOPY} -O binary ${PROGSYM} ${.TARGET}
    106 
    107 # Prevent the normal install target from doing anything.
    108 proginstall::
    109 
    110 # Install the raw binary or the symbol version, based on whether or
    111 # not the resulting gzboot needs to be mdsetimage'd.
    112 .if ${MAXIMAGESIZE} == "0"
    113 FILES=	${PROG}
    114 .else
    115 FILES=	${PROGSYM}
    116 .endif
    117 
    118 .include <bsd.prog.mk>
    119 
    120 ${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    121 	${_MKTARGET_LINK}
    122 	${LD} -o ${.TARGET} ${LDFLAGS} ${STARTFILE} \
    123 	    ${OBJS} ${LIBLIST} > ${BASE}.list
    124