Makefile.gzboot revision 1.38 1 # $NetBSD: Makefile.gzboot,v 1.38 2020/02/12 19:55:32 thorpej Exp $
2
3 NOMAN= # defined
4
5 .include <bsd.init.mk> # Pull in OBJDIR name rules.
6 .include <bsd.own.mk>
7 .include <bsd.klinks.mk>
8
9 EVBARM_STAND= ${S}/arch/evbarm/stand
10
11 BASE= gzboot_${PLATFORM}_${RELOC}
12 PROGSYM=${BASE}.sym
13 PROG= ${BASE}.bin
14 WARNS= 1
15
16 NEWVERSWHAT= "Gzip Boot"
17 BINMODE=644
18
19 DBG= -Os
20
21 # XXX SHOULD NOT NEED TO DEFINE THESE!
22 LIBCRT0=
23 LIBCRTI=
24 LIBC=
25 LIBCRTBEGIN=
26 LIBCRTEND=
27 STRIPFLAG=
28
29 .PATH: ${EVBARM_STAND}/gzboot
30 .PATH: ${EVBARM_STAND}/board
31
32 SRCS+= gzboot.c image.S
33
34 STARTFILE= srtbegin.o
35
36 CPPFLAGS+= -nostdinc -I. -I${EVBARM_STAND}/gzboot -I${EVBARM_STAND}/board
37 CPPFLAGS+= -I${S} -I${S}/arch -I${S}/lib/libsa
38 CPPFLAGS+= -I${S}/../common/dist/zlib
39 CPPFLAGS+= ${ARM_APCS_FLAGS}
40
41 CPPFLAGS+= -D_STANDALONE
42
43 # Specify the heap size (used by board mem_init() routines)
44 CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576 # 1M
45
46 # libsa options
47 CPPFLAGS+= -DHEAP_VARIABLE
48
49 CPPFLAGS+= -DRELOC=${RELOC}
50 CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
51 CPPFLAGS+= -DLOADADDR=${LOADADDR}
52 .if defined(GZSRCADDR)
53 CPPFLAGS+= -DGZSRCADDR=${GZSRCADDR}
54 .endif
55
56 COPTS+= -ffreestanding
57 COPTS+= -fno-stack-protector
58 COPTS+= -fno-unwind-tables
59 CWARNFLAGS+= -Werror
60 CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
61
62 CLEANFILES+= ${STARTFILE} ${BASE}.list
63 CLEANFILES+= ${PROGSYM}
64
65 ### find out what to use for libkern
66 KERN_AS= library
67 .include "${S}/lib/libkern/Makefile.inc"
68 LIBKERN= ${KERNLIB}
69
70 ### find out what to use for libz
71 Z_AS= library
72 .include "${S}/lib/libz/Makefile.inc"
73 LIBZ= ${ZLIB}
74
75 ### find out what to use for libsa
76 SA_AS= library
77 .include "${S}/lib/libsa/Makefile.inc"
78 LIBSA= ${SALIB}
79
80 cleandir distclean: .WAIT cleanlibdir
81
82 cleanlibdir:
83 -rm -rf lib
84
85 DIRECT_LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx
86
87 LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
88
89 .include "${S}/conf/newvers_stand.mk"
90
91 ${PROG}: ${PROGSYM}
92 ${OBJCOPY} -O binary ${PROGSYM} ${.TARGET}
93
94 # Prevent the normal install target from doing anything.
95 proginstall::
96
97 # Install the raw binary or the symbol version, based on whether or
98 # not the resulting gzboot needs to be mdsetimage'd.
99 .if ${MAXIMAGESIZE} == "0"
100 FILES= ${PROG}
101 .else
102 FILES= ${PROGSYM}
103 .endif
104
105 .include <bsd.prog.mk>
106
107 ${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
108 ${_MKTARGET_LINK}
109 ${LD} -o ${.TARGET} ${DIRECT_LDFLAGS} ${STARTFILE} \
110 ${OBJS} ${LIBLIST} > ${BASE}.list
111