Makefile revision 262197
1#-
2# Copyright (c) 2013-2014 Robert N. M. Watson
3# All rights reserved.
4#
5# This software was developed by SRI International and the University of
6# Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7# ("CTSRD"), as part of the DARPA CRASH research programme.
8#
9# @BERI_LICENSE_HEADER_START@
10#
11# Licensed to BERI Open Systems C.I.C (BERI) under one or more contributor
12# license agreements.  See the NOTICE file distributed with this work for
13# additional information regarding copyright ownership.  BERI licenses this
14# file to you under the BERI Hardware-Software License, Version 1.0 (the
15# "License"); you may not use this file except in compliance with the
16# License.  You may obtain a copy of the License at:
17#
18#   http://www.beri-open-systems.org/legal/license-1-0.txt
19#
20# Unless required by applicable law or agreed to in writing, Work distributed
21# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
22# CONDITIONS OF ANY KIND, either express or implied.  See the License for the
23# specific language governing permissions and limitations under the License.
24#
25# @BERI_LICENSE_HEADER_END@
26#
27
28# $FreeBSD: head/sys/boot/mips/beri/loader/Makefile 262197 2014-02-18 23:18:32Z rwatson $
29
30.include <bsd.own.mk>
31MK_SSP=		no
32
33PROG?=		loader
34NEWVERSWHAT=	"BERI loader" ${MACHINE_CPUARCH}
35INSTALLFLAGS=	-b
36
37# Architecture-specific loader code
38SRCS=		start.S						\
39		main.c						\
40		devicename.c					\
41		exec.c						\
42		metadata.c					\
43		vers.c						\
44		arch.c
45
46# libstand front-ends for shared driver code
47SRCS+=		beri_console.c					\
48		beri_disk_cfi.c					\
49		beri_disk_sdcard.c
50
51# Common code with boot2
52SRCS+=		altera_jtag_uart.c				\
53		cfi.c						\
54		sdcard.c
55
56# Since we don't have a backward compatibility issue, default to this on BERI.
57CFLAGS+=	-DBOOT_PROMPT_123
58
59CFLAGS+=	-DLOADER_DISK_SUPPORT
60CFLAGS+=	-DLOADER_UFS_SUPPORT
61CFLAGS+=	-DLOADER_GZIP_SUPPORT
62CFLAGS+=	-DLOADER_BZIP2_SUPPORT
63
64#CFLAGS+=	-DLOADER_NET_SUPPORT
65#CFLAGS+=	-DLOADER_NFS_SUPPORT
66#CFLAGS+=	-DLOADER_TFTP_SUPPORT
67
68.if ${MK_FORTH} != "no"
69# Enable BootForth
70BOOT_FORTH=	yes
71CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../../ficl
72CFLAGS+=	-I${.CURDIR}/../../../ficl/mips
73LIBFICL=	${.OBJDIR}/../../../ficl/libficl.a
74.endif
75
76# Common code across BERI boot loader parts
77.PATH:		${.CURDIR}/../common
78CFLAGS+=	-I${.CURDIR}/../common
79
80# Always add MI sources
81.PATH:		${.CURDIR}/../../../common
82.include	"${.CURDIR}/../../../common/Makefile.inc"
83CFLAGS+=	-I${.CURDIR}/../../../common
84
85# BERI files common to boot2 and loader
86.PATH:		${.CURDIR}/../common
87CFLAGS+=	-I${.CURDIR}/../common
88
89# Loader-specific MD headers
90CFLAGS+=	-I${.CURDIR}
91
92CLEANFILES+=	vers.c loader.help
93
94# Generate code appropriate for the loader environment
95CFLAGS+=	-G0					\
96		-fno-pic				\
97		-mno-abicalls				\
98		-msoft-float				\
99		-g
100
101LDFLAGS=	-nostdlib				\
102		-static					\
103		-T ${.CURDIR}/loader.ldscript		\
104		-L${.CURDIR}				\
105		-e __start
106
107# where to get libstand from
108CFLAGS+=	-I${.CURDIR}/../../../../../lib/libstand/
109LIBSTAND=	${.OBJDIR}/../../../../../lib/libstand/libstand.a
110
111DPADD=		${LIBFICL} ${LIBSTAND}
112LDADD=		${LIBFICL} ${LIBSTAND}
113
114vers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version
115	sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version	\
116	    ${NEWVERSWHAT}
117
118loader.help: help.common help.mips
119	cat ${.ALLSRC} | \
120	    awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET}
121
122.PATH: ${.CURDIR}/../../../forth
123FILES=	loader.help loader.4th support.4th loader.conf
124FILES+=	screen.4th frames.4th
125FILES+=	beastie.4th brand.4th check-password.4th color.4th delay.4th
126FILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
127FILESDIR_loader.conf=	/boot/defaults
128
129.if !exists(${DESTDIR}/boot/loader.rc)
130FILES+= loader.rc
131.endif
132
133.if !exists(${DESTDIR}/boot/menu.rc)
134FILES+= menu.rc
135.endif
136
137all: loader
138
139.include <bsd.prog.mk>
140