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