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