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