Makefile.gzboot revision 1.20
1#	$NetBSD: Makefile.gzboot,v 1.20 2012/08/13 10:25:02 khorben Exp $
2
3NOMAN=  # defined
4
5.include <bsd.obj.mk>		# Pull in OBJDIR name rules.
6.include <bsd.own.mk>
7
8EVBARM_STAND=	${S}/arch/evbarm/stand
9
10BASE=	gzboot_${PLATFORM}_${RELOC}
11PROGSYM=${BASE}.sym
12PROG=	${BASE}.bin
13WARNS=	1
14
15NEWVERSWHAT=	"Gzip Boot"
16VERSIONFILE=	${EVBARM_STAND}/gzboot/version
17
18BINMODE=644
19
20DBG=	-Os
21
22# XXX SHOULD NOT NEED TO DEFINE THESE!
23LIBCRT0=
24LIBC=
25LIBCRTBEGIN= 
26LIBCRTEND=      
27
28.PATH: ${EVBARM_STAND}/gzboot
29.PATH: ${EVBARM_STAND}/board
30
31SRCS+=	gzboot.c image.S
32
33STARTFILE= srtbegin.o
34
35CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board
36CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa
37CPPFLAGS+= -I${S}/../common/dist/zlib
38
39CPPFLAGS+= -D_STANDALONE
40
41# Specify the heap size (used by board mem_init() routines)
42CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576		# 1M
43
44# libsa options
45CPPFLAGS+= -DHEAP_VARIABLE
46
47CPPFLAGS+= -DRELOC=${RELOC}
48CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
49CPPFLAGS+= -DLOADADDR=${LOADADDR}
50
51COPTS+=	-ffreestanding
52COPTS+=	-fno-stack-protector
53CWARNFLAGS+= -Werror
54CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
55
56CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
57CLEANFILES+= ${PROGSYM}
58SRCS+= vers.c
59
60.if !make(obj) && !make(clean) && !make(cleandir)
61.NOPATH: machine
62.endif
63
64realdepend realall: machine
65CLEANFILES+= arm machine
66
67machine::
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
75KERN_AS=	library
76.include "${S}/lib/libkern/Makefile.inc"
77LIBKERN=	${KERNLIB}
78
79### find out what to use for libz
80Z_AS=		library
81.include "${S}/lib/libz/Makefile.inc"
82LIBZ=		${ZLIB}
83
84### find out what to use for libsa
85SA_AS=		library
86.include "${S}/lib/libsa/Makefile.inc"
87LIBSA=		${SALIB}
88
89cleandir distclean: .WAIT cleanlibdir
90
91cleanlibdir:
92	-rm -rf lib
93
94LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx
95
96LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
97
98.PHONY: vers.c
99vers.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.
107proginstall::
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"
112FILES=	${PROG}
113.else
114FILES=	${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