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