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