Makefile.gzboot revision 1.15
1#	$NetBSD: Makefile.gzboot,v 1.15 2009/01/12 07:45:24 tsutsui 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
52CWARNFLAGS+= -Werror
53CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
54
55CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
56CLEANFILES+= ${PROGSYM}
57SRCS+= vers.c
58
59.if !make(obj) && !make(clean) && !make(cleandir)
60.NOPATH: machine
61.endif
62
63realdepend realall: machine
64CLEANFILES+= arm machine
65
66machine::
67	-rm -f arm machine
68	ln -s ${S}/arch/evbarm/include machine
69	ln -s ${S}/arch/arm/include arm
70
71${OBJS}: machine
72
73### find out what to use for libkern
74KERN_AS=	library
75.include "${S}/lib/libkern/Makefile.inc"
76LIBKERN=	${KERNLIB}
77
78### find out what to use for libz
79Z_AS=		library
80.include "${S}/lib/libz/Makefile.inc"
81LIBZ=		${ZLIB}
82
83### find out what to use for libsa
84SA_AS=		library
85.include "${S}/lib/libsa/Makefile.inc"
86LIBSA=		${SALIB}
87
88cleandir distclean: cleanlibdir
89
90cleanlibdir:
91	-rm -rf lib
92
93LDFLAGS= -M -T ${LDSCRIPT}
94
95LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
96
97.PHONY: vers.c
98vers.c: ${VERSIONFILE}
99	${HOST_SH} ${S}/conf/newvers_stand.sh ${.ALLSRC} '${PLATFORM}' \
100	    ${NEWVERSWHAT}
101
102${PROG}: ${PROGSYM}
103	${OBJCOPY} -O binary ${PROGSYM} ${.TARGET}
104
105# Prevent the normal install target from doing anything.
106proginstall::
107
108# Install the raw binary or the symbol version, based on whether or
109# not the resulting gzboot needs to be mdsetimage'd.
110.if ${MAXIMAGESIZE} == "0"
111FILES=	${PROG}
112.else
113FILES=	${PROGSYM}
114.endif
115
116.include <bsd.prog.mk>
117
118${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
119	${LD} -o ${.TARGET} ${LDFLAGS} ${STARTFILE} \
120	    ${OBJS} ${LIBLIST} > ${BASE}.list
121