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