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#
30262197Srwatson# $FreeBSD: head/sys/boot/mips/beri/loader/Makefile 262198 2014-02-18 23:22:54Z rwatson $
31262197Srwatson
32262197Srwatson.include <bsd.own.mk>
33262197SrwatsonMK_SSP=		no
34262197Srwatson
35262197SrwatsonPROG?=		loader
36262197SrwatsonNEWVERSWHAT=	"BERI loader" ${MACHINE_CPUARCH}
37262197SrwatsonINSTALLFLAGS=	-b
38262197Srwatson
39262197Srwatson# Architecture-specific loader code
40262197SrwatsonSRCS=		start.S						\
41262197Srwatson		main.c						\
42262197Srwatson		devicename.c					\
43262197Srwatson		exec.c						\
44262197Srwatson		metadata.c					\
45262197Srwatson		vers.c						\
46262197Srwatson		arch.c
47262197Srwatson
48262197Srwatson# libstand front-ends for shared driver code
49262197SrwatsonSRCS+=		beri_console.c					\
50262197Srwatson		beri_disk_cfi.c					\
51262197Srwatson		beri_disk_sdcard.c
52262197Srwatson
53262197Srwatson# Common code with boot2
54262197SrwatsonSRCS+=		altera_jtag_uart.c				\
55262197Srwatson		cfi.c						\
56262197Srwatson		sdcard.c
57262197Srwatson
58262197Srwatson# Since we don't have a backward compatibility issue, default to this on BERI.
59262197SrwatsonCFLAGS+=	-DBOOT_PROMPT_123
60262197Srwatson
61262197SrwatsonCFLAGS+=	-DLOADER_DISK_SUPPORT
62262197SrwatsonCFLAGS+=	-DLOADER_UFS_SUPPORT
63262197SrwatsonCFLAGS+=	-DLOADER_GZIP_SUPPORT
64262197SrwatsonCFLAGS+=	-DLOADER_BZIP2_SUPPORT
65262197Srwatson
66262197Srwatson#CFLAGS+=	-DLOADER_NET_SUPPORT
67262197Srwatson#CFLAGS+=	-DLOADER_NFS_SUPPORT
68262197Srwatson#CFLAGS+=	-DLOADER_TFTP_SUPPORT
69262197Srwatson
70262197Srwatson.if ${MK_FORTH} != "no"
71262197Srwatson# Enable BootForth
72262197SrwatsonBOOT_FORTH=	yes
73262197SrwatsonCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../../ficl
74262197SrwatsonCFLAGS+=	-I${.CURDIR}/../../../ficl/mips
75262197SrwatsonLIBFICL=	${.OBJDIR}/../../../ficl/libficl.a
76262197Srwatson.endif
77262197Srwatson
78262197Srwatson# Common code across BERI boot loader parts
79262197Srwatson.PATH:		${.CURDIR}/../common
80262197SrwatsonCFLAGS+=	-I${.CURDIR}/../common
81262197Srwatson
82262197Srwatson# Always add MI sources
83262197Srwatson.PATH:		${.CURDIR}/../../../common
84262197Srwatson.include	"${.CURDIR}/../../../common/Makefile.inc"
85262197SrwatsonCFLAGS+=	-I${.CURDIR}/../../../common
86262197Srwatson
87262197Srwatson# BERI files common to boot2 and loader
88262197Srwatson.PATH:		${.CURDIR}/../common
89262197SrwatsonCFLAGS+=	-I${.CURDIR}/../common
90262197Srwatson
91262197Srwatson# Loader-specific MD headers
92262197SrwatsonCFLAGS+=	-I${.CURDIR}
93262197Srwatson
94262197SrwatsonCLEANFILES+=	vers.c loader.help
95262197Srwatson
96262197Srwatson# Generate code appropriate for the loader environment
97262197SrwatsonCFLAGS+=	-G0					\
98262197Srwatson		-fno-pic				\
99262197Srwatson		-mno-abicalls				\
100262197Srwatson		-msoft-float				\
101262197Srwatson		-g
102262197Srwatson
103262197SrwatsonLDFLAGS=	-nostdlib				\
104262197Srwatson		-static					\
105262197Srwatson		-T ${.CURDIR}/loader.ldscript		\
106262197Srwatson		-L${.CURDIR}				\
107262197Srwatson		-e __start
108262197Srwatson
109262197Srwatson# where to get libstand from
110262197SrwatsonCFLAGS+=	-I${.CURDIR}/../../../../../lib/libstand/
111262197SrwatsonLIBSTAND=	${.OBJDIR}/../../../../../lib/libstand/libstand.a
112262197Srwatson
113262197SrwatsonDPADD=		${LIBFICL} ${LIBSTAND}
114262197SrwatsonLDADD=		${LIBFICL} ${LIBSTAND}
115262197Srwatson
116262197Srwatsonvers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version
117262197Srwatson	sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version	\
118262197Srwatson	    ${NEWVERSWHAT}
119262197Srwatson
120262197Srwatsonloader.help: help.common help.mips
121262197Srwatson	cat ${.ALLSRC} | \
122262197Srwatson	    awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET}
123262197Srwatson
124262197Srwatson.PATH: ${.CURDIR}/../../../forth
125262197SrwatsonFILES=	loader.help loader.4th support.4th loader.conf
126262197SrwatsonFILES+=	screen.4th frames.4th
127262197SrwatsonFILES+=	beastie.4th brand.4th check-password.4th color.4th delay.4th
128262197SrwatsonFILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
129262197SrwatsonFILESDIR_loader.conf=	/boot/defaults
130262197Srwatson
131262197Srwatson.if !exists(${DESTDIR}/boot/loader.rc)
132262197SrwatsonFILES+= loader.rc
133262197Srwatson.endif
134262197Srwatson
135262197Srwatson.if !exists(${DESTDIR}/boot/menu.rc)
136262197SrwatsonFILES+= menu.rc
137262197Srwatson.endif
138262197Srwatson
139262197Srwatsonall: loader
140262197Srwatson
141262197Srwatson.include <bsd.prog.mk>
142