Makefile.gzboot revision 1.15 1 # $NetBSD: Makefile.gzboot,v 1.15 2009/01/12 07:45:24 tsutsui Exp $
2
3 NOMAN= # defined
4
5 .include <bsd.obj.mk> # Pull in OBJDIR name rules.
6 .include <bsd.own.mk>
7
8 EVBARM_STAND= ${S}/arch/evbarm/stand
9
10 BASE= gzboot_${PLATFORM}_${RELOC}
11 PROGSYM=${BASE}.sym
12 PROG= ${BASE}.bin
13 WARNS= 1
14
15 NEWVERSWHAT= "Gzip Boot"
16 VERSIONFILE= ${EVBARM_STAND}/gzboot/version
17
18 BINMODE=644
19
20 DBG= -Os
21
22 # XXX SHOULD NOT NEED TO DEFINE THESE!
23 LIBCRT0=
24 LIBC=
25 LIBCRTBEGIN=
26 LIBCRTEND=
27
28 .PATH: ${EVBARM_STAND}/gzboot
29 .PATH: ${EVBARM_STAND}/board
30
31 SRCS+= gzboot.c image.S
32
33 STARTFILE= srtbegin.o
34
35 CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board
36 CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa
37 CPPFLAGS+= -I${S}/../common/dist/zlib
38
39 CPPFLAGS+= -D_STANDALONE
40
41 # Specify the heap size (used by board mem_init() routines)
42 CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576 # 1M
43
44 # libsa options
45 CPPFLAGS+= -DHEAP_VARIABLE
46
47 CPPFLAGS+= -DRELOC=${RELOC}
48 CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
49 CPPFLAGS+= -DLOADADDR=${LOADADDR}
50
51 COPTS+= -ffreestanding
52 CWARNFLAGS+= -Werror
53 CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
54
55 CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
56 CLEANFILES+= ${PROGSYM}
57 SRCS+= vers.c
58
59 .if !make(obj) && !make(clean) && !make(cleandir)
60 .NOPATH: machine
61 .endif
62
63 realdepend realall: machine
64 CLEANFILES+= arm machine
65
66 machine::
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
74 KERN_AS= library
75 .include "${S}/lib/libkern/Makefile.inc"
76 LIBKERN= ${KERNLIB}
77
78 ### find out what to use for libz
79 Z_AS= library
80 .include "${S}/lib/libz/Makefile.inc"
81 LIBZ= ${ZLIB}
82
83 ### find out what to use for libsa
84 SA_AS= library
85 .include "${S}/lib/libsa/Makefile.inc"
86 LIBSA= ${SALIB}
87
88 cleandir distclean: cleanlibdir
89
90 cleanlibdir:
91 -rm -rf lib
92
93 LDFLAGS= -M -T ${LDSCRIPT}
94
95 LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
96
97 .PHONY: vers.c
98 vers.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.
106 proginstall::
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"
111 FILES= ${PROG}
112 .else
113 FILES= ${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