Makefile.gzboot revision 1.27
1#	$NetBSD: Makefile.gzboot,v 1.27 2013/11/04 21:25:05 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.else
43CPPFLAGS+= -marm
44.endif
45
46CPPFLAGS+= -D_STANDALONE
47
48# Specify the heap size (used by board mem_init() routines)
49CPPFLAGS+= -DBOARD_HEAP_SIZE=1048576		# 1M
50
51# libsa options
52CPPFLAGS+= -DHEAP_VARIABLE
53
54CPPFLAGS+= -DRELOC=${RELOC}
55CPPFLAGS+= -DMAXIMAGESIZE=${MAXIMAGESIZE}
56CPPFLAGS+= -DLOADADDR=${LOADADDR}
57
58COPTS+=	-ffreestanding
59COPTS+=	-fno-stack-protector
60COPTS+=	-fno-unwind-tables
61CWARNFLAGS+= -Werror
62CWARNFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
63
64CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
65CLEANFILES+= ${PROGSYM}
66SRCS+= vers.c
67
68### find out what to use for libkern
69KERN_AS=	library
70.include "${S}/lib/libkern/Makefile.inc"
71LIBKERN=	${KERNLIB}
72
73### find out what to use for libz
74Z_AS=		library
75.include "${S}/lib/libz/Makefile.inc"
76LIBZ=		${ZLIB}
77
78### find out what to use for libsa
79SA_AS=		library
80.include "${S}/lib/libsa/Makefile.inc"
81LIBSA=		${SALIB}
82
83cleandir distclean: .WAIT cleanlibdir
84
85cleanlibdir:
86	-rm -rf lib
87
88LDFLAGS= -M -T ${LDSCRIPT} --fix-v4bx
89
90LIBLIST=${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
91
92.PHONY: vers.c
93vers.c: ${VERSIONFILE}
94	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
95	    ${.ALLSRC} '${PLATFORM}' ${NEWVERSWHAT}
96
97${PROG}: ${PROGSYM}
98	${OBJCOPY} -O binary ${PROGSYM} ${.TARGET}
99
100# Prevent the normal install target from doing anything.
101proginstall::
102
103# Install the raw binary or the symbol version, based on whether or
104# not the resulting gzboot needs to be mdsetimage'd.
105.if ${MAXIMAGESIZE} == "0"
106FILES=	${PROG}
107.else
108FILES=	${PROGSYM}
109.endif
110
111.include <bsd.prog.mk>
112
113${PROGSYM}: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
114	${_MKTARGET_LINK}
115	${LD} -o ${.TARGET} ${LDFLAGS} ${STARTFILE} \
116	    ${OBJS} ${LIBLIST} > ${BASE}.list
117