Makefile revision 262198
1262197Srwatson#-
2262197Srwatson# Copyright (c) 2013-2014 Robert N. M. Watson
3262197Srwatson# All rights reserved.
4262197Srwatson#
5262197Srwatson# This software was developed by SRI International and the University of
6262197Srwatson# Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7262197Srwatson# ("CTSRD"), as part of the DARPA CRASH research programme.
8262197Srwatson#
9262198Srwatson# Redistribution and use in source and binary forms, with or without
10262198Srwatson# modification, are permitted provided that the following conditions
11262198Srwatson# are met:
12262198Srwatson# 1. Redistributions of source code must retain the above copyright
13262198Srwatson#    notice, this list of conditions and the following disclaimer.
14262198Srwatson# 2. Redistributions in binary form must reproduce the above copyright
15262198Srwatson#    notice, this list of conditions and the following disclaimer in the
16262198Srwatson#    documentation and/or other materials provided with the distribution.
17262197Srwatson#
18262198Srwatson# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19262198Srwatson# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20262198Srwatson# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21262198Srwatson# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22262198Srwatson# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23262198Srwatson# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24262198Srwatson# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25262198Srwatson# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26262198Srwatson# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27262198Srwatson# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28262198Srwatson# SUCH DAMAGE.
29262197Srwatson#
30262198Srwatson# $FreeBSD: head/sys/boot/mips/beri/boot2/Makefile 262198 2014-02-18 23:22:54Z rwatson $
31262197Srwatson
32262197SrwatsonBINDIR?=	/boot
33262197SrwatsonINSTALLFLAGS=	-b
34262197Srwatson
35262197SrwatsonLOADERS=	flashboot jtagboot
36262197SrwatsonFILES=		${LOADERS} ${LOADERS:S/$/.md5/}
37262197Srwatson
38262197SrwatsonSRCS=		relocate.S		\
39262197Srwatson		start.S			\
40262197Srwatson		boot2.c			\
41262197Srwatson		altera_jtag_uart.c	\
42262197Srwatson		cfi.c			\
43262197Srwatson		sdcard.c
44262197Srwatson
45262197SrwatsonNO_MAN=
46262197Srwatson
47262197SrwatsonAFLAGS=		-G0
48262197Srwatson
49262197SrwatsonCFLAGS=		-ffreestanding			\
50262197Srwatson		-I${.CURDIR}			\
51262197Srwatson		-I${.CURDIR}/../../../common	\
52262197Srwatson		-I${.CURDIR}/../../../..	\
53262197Srwatson		-D_KERNEL			\
54262197Srwatson		-Wall				\
55262197Srwatson		-G0 -Xassembler -G0		\
56262197Srwatson		-fno-pic -mno-abicalls		\
57262197Srwatson		-msoft-float			\
58262197Srwatson		-g
59262197Srwatson
60262197Srwatson# where to get libstand from
61262197SrwatsonCFLAGS+=	-I${.CURDIR}/../../../../../lib/libstand/
62262197SrwatsonLIBSTAND=	${.OBJDIR}/../../../../../lib/libstand/libstand.a
63262197Srwatson
64262197SrwatsonLDFLAGS=	-nostdlib			\
65262197Srwatson		-static				\
66262197Srwatson		-N				\
67262197Srwatson		-G0				\
68262197Srwatson		-L${.CURDIR}
69262197Srwatson
70262197Srwatson.PATH:		${.CURDIR}/../common
71262197SrwatsonCFLAGS+=	-I${.CURDIR}/../common
72262197Srwatson
73262197Srwatsonflashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
74262197Srwatson	${LD} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET}	\
75262197Srwatson	    ${.ALLSRC} ${LIBSTAND}
76262197Srwatsonflashboot: flashboot.elf
77262197Srwatson	objcopy -S -O binary ${.TARGET}.elf ${.TARGET}
78262197Srwatsonflashboot.md5: flashboot
79262197Srwatson	md5 flashboot > flashboot.md5
80262197Srwatson
81262197Srwatsonjtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
82262197Srwatson	${LD} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET}	\
83262197Srwatson	    ${.ALLSRC} ${LIBSTAND}
84262197Srwatsonjtagboot.md5: jtagboot
85262197Srwatson	md5 jtagboot > jtagboot.md5
86262197Srwatson
87262197SrwatsonCLEANFILES+=	flashboot.elf
88262197Srwatson
89262197Srwatson.include <bsd.prog.mk>
90