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