Makefile revision 281009
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# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28# SUCH DAMAGE. 29# 30# $FreeBSD: head/sys/boot/mips/beri/loader/Makefile 281009 2015-04-03 02:27:40Z jkim $ 31 32.include <src.opts.mk> 33MK_SSP= no 34 35PROG?= loader 36NEWVERSWHAT= "BERI loader" ${MACHINE_CPUARCH} 37INSTALLFLAGS= -b 38 39# Architecture-specific loader code 40SRCS= start.S \ 41 main.c \ 42 devicename.c \ 43 exec.c \ 44 metadata.c \ 45 vers.c \ 46 arch.c 47 48# libstand front-ends for shared driver code 49SRCS+= beri_console.c \ 50 beri_disk_cfi.c \ 51 beri_disk_sdcard.c 52 53# Common code with boot2 54SRCS+= altera_jtag_uart.c \ 55 cfi.c \ 56 sdcard.c 57 58# Since we don't have a backward compatibility issue, default to this on BERI. 59CFLAGS+= -DBOOT_PROMPT_123 60 61CFLAGS+= -DLOADER_DISK_SUPPORT 62CFLAGS+= -DLOADER_UFS_SUPPORT 63CFLAGS+= -DLOADER_GZIP_SUPPORT 64CFLAGS+= -DLOADER_BZIP2_SUPPORT 65 66#CFLAGS+= -DLOADER_NET_SUPPORT 67#CFLAGS+= -DLOADER_NFS_SUPPORT 68#CFLAGS+= -DLOADER_TFTP_SUPPORT 69 70.if ${MK_FORTH} != "no" 71# Enable BootForth 72BOOT_FORTH= yes 73CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../../ficl 74CFLAGS+= -I${.CURDIR}/../../../ficl/mips 75LIBFICL= ${.OBJDIR}/../../../ficl/libficl.a 76.endif 77 78# Common code across BERI boot loader parts 79.PATH: ${.CURDIR}/../common 80CFLAGS+= -I${.CURDIR}/../common 81 82# Always add MI sources 83.PATH: ${.CURDIR}/../../../common 84.include "${.CURDIR}/../../../common/Makefile.inc" 85CFLAGS+= -I${.CURDIR}/../../../common 86 87# BERI files common to boot2 and loader 88.PATH: ${.CURDIR}/../common 89CFLAGS+= -I${.CURDIR}/../common 90 91# Loader-specific MD headers 92CFLAGS+= -I${.CURDIR} 93 94CLEANFILES+= vers.c loader.help 95 96# Generate code appropriate for the loader environment 97CFLAGS+= -G0 \ 98 -fno-pic \ 99 -mno-abicalls \ 100 -msoft-float \ 101 -g 102 103LDFLAGS= -nostdlib \ 104 -static \ 105 -T ${.CURDIR}/loader.ldscript \ 106 -L${.CURDIR} \ 107 -e __start 108 109# where to get libstand from 110CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/ 111LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a 112 113DPADD= ${LIBFICL} ${LIBSTAND} 114LDADD= ${LIBFICL} ${LIBSTAND} 115 116vers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version 117 sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version \ 118 ${NEWVERSWHAT} 119 120loader.help: help.common help.mips 121 cat ${.ALLSRC} | \ 122 awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET} 123 124.PATH: ${.CURDIR}/../../../forth 125.include "${.CURDIR}/../../forth/Makefile.inc" 126 127.if !exists(${DESTDIR}/boot/loader.rc) 128FILES+= loader.rc 129.endif 130 131.if !exists(${DESTDIR}/boot/menu.rc) 132FILES+= menu.rc 133.endif 134 135.if defined(LOADER_USB_SUPPORT) 136# Do garbage collection 137CFLAGS+= -ffunction-sections -fdata-sections 138CFLAGS+= -Wl,--gc-sections 139# Link USB BOOT library 140LDADD+= ${.OBJDIR}/../../../usb/libusbboot.a 141CFLAGS+= -I${.CURDIR}/../../../usb 142# Define USB SUPPORT 143CFLAGS+= -DLOADER_USB_SUPPORT 144.endif 145 146all: loader 147 148.include <bsd.prog.mk> 149