Makefile.gzboot revision 1.14
1#	$NetBSD: Makefile.gzboot,v 1.14 2006/01/16 19:34:53 he 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+= -DBOARD_HEAP_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.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