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: stable/11/stand/mips/beri/boot2/Makefile 337477 2018-08-08 18:05:14Z bdrewery $
31262197Srwatson
32329140Skevans.include <bsd.init.mk>
33329140Skevans
34262197SrwatsonINSTALLFLAGS=	-b
35262197Srwatson
36262197SrwatsonLOADERS=	flashboot jtagboot
37262197SrwatsonFILES=		${LOADERS} ${LOADERS:S/$/.md5/}
38262197Srwatson
39262197SrwatsonSRCS=		relocate.S		\
40262197Srwatson		start.S			\
41262197Srwatson		boot2.c			\
42262197Srwatson		altera_jtag_uart.c	\
43262197Srwatson		cfi.c			\
44262197Srwatson		sdcard.c
45262197Srwatson
46262197SrwatsonAFLAGS=		-G0
47262197Srwatson
48329175SkevansCFLAGS+=	-I${LDRSRC}			\
49262197Srwatson		-Wall				\
50329099Skevans		-G0 				\
51262197Srwatson		-fno-pic -mno-abicalls		\
52262197Srwatson		-g
53262197Srwatson
54329175SkevansLDFLAGS+=	-static				\
55329100Skevans		-Wl,-N				\
56262197Srwatson		-G0				\
57262197Srwatson		-L${.CURDIR}
58262197Srwatson
59329140Skevans.PATH:		${BOOTSRC}/mips/beri/common
60329140SkevansCFLAGS+=	-I${BOOTSRC}/mips/beri/common
61262197Srwatson
62262197Srwatsonflashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
63337477Sbdrewery	${CC:N${CCACHE_BIN}} ${LDFLAGS} -T ${.CURDIR}/flashboot.ldscript \
64337477Sbdrewery	    -o ${.TARGET} ${.ALLSRC} ${LIBSA}
65262197Srwatsonflashboot: flashboot.elf
66280980Sdim	${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}
67262197Srwatsonflashboot.md5: flashboot
68262197Srwatson	md5 flashboot > flashboot.md5
69262197Srwatson
70262197Srwatsonjtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o
71337477Sbdrewery	${CC:N${CCACHE_BIN}} ${LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript \
72337477Sbdrewery	    -o ${.TARGET} ${.ALLSRC} ${LIBSA}
73262197Srwatsonjtagboot.md5: jtagboot
74262197Srwatson	md5 jtagboot > jtagboot.md5
75262197Srwatson
76262197SrwatsonCLEANFILES+=	flashboot.elf
77262197Srwatson
78262197Srwatson.include <bsd.prog.mk>
79