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