1*ca987d46SWarner Losh# $FreeBSD$ 2*ca987d46SWarner Losh 3*ca987d46SWarner Losh.include <src.opts.mk> 4*ca987d46SWarner Losh 5*ca987d46SWarner Losh.if !defined(__BOOT_DEFS_MK__) 6*ca987d46SWarner Losh__BOOT_DEFS_MK__=${MFILE} 7*ca987d46SWarner Losh 8*ca987d46SWarner LoshBOOTSRC= ${SRCTOP}/stand 9*ca987d46SWarner LoshEFISRC= ${BOOTSRC}/efi 10*ca987d46SWarner LoshEFIINC= ${EFISRC}/include 11*ca987d46SWarner LoshEFIINCMD= ${EFIINC}/${MACHINE} 12*ca987d46SWarner LoshFDTSRC= ${BOOTSRC}/fdt 13*ca987d46SWarner LoshFICLSRC= ${BOOTSRC}/ficl 14*ca987d46SWarner LoshLDRSRC= ${BOOTSRC}/common 15*ca987d46SWarner LoshSASRC= ${BOOTSRC}/libsa 16*ca987d46SWarner LoshSYSDIR= ${SRCTOP}/sys 17*ca987d46SWarner LoshUBOOTSRC= ${BOOTSRC}/uboot 18*ca987d46SWarner LoshZFSSRC= ${BOOTSRC}/zfs 19*ca987d46SWarner Losh 20*ca987d46SWarner LoshBOOTOBJ= ${OBJTOP}/stand 21*ca987d46SWarner Losh 22*ca987d46SWarner Losh# BINDIR is where we install 23*ca987d46SWarner LoshBINDIR?= /boot 24*ca987d46SWarner Losh 25*ca987d46SWarner Losh# NB: The makefiles depend on these being empty when we don't build forth. 26*ca987d46SWarner Losh.if ${MK_FORTH} != "no" 27*ca987d46SWarner LoshLIBFICL= ${BOOTOBJ}/ficl/libficl.a 28*ca987d46SWarner Losh.if ${MACHINE} == "i386" 29*ca987d46SWarner LoshLIBFICL32= ${LIBFICL} 30*ca987d46SWarner Losh.else 31*ca987d46SWarner LoshLIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 32*ca987d46SWarner Losh.endif 33*ca987d46SWarner Losh.endif 34*ca987d46SWarner LoshLIBSA= ${BOOTOBJ}/libsa/libsa.a 35*ca987d46SWarner Losh.if ${MACHINE} == "i386" 36*ca987d46SWarner LoshLIBSA32= ${LIBSA} 37*ca987d46SWarner Losh.else 38*ca987d46SWarner LoshLIBSA32= ${BOOTOBJ}/libsa32/libsa32.a 39*ca987d46SWarner Losh.endif 40*ca987d46SWarner Losh 41*ca987d46SWarner Losh# Standard options: 42*ca987d46SWarner Losh 43*ca987d46SWarner Losh# Filesystem support 44*ca987d46SWarner Losh.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 45*ca987d46SWarner LoshCFLAGS+= -DLOADER_CD9660_SUPPORT 46*ca987d46SWarner Losh.endif 47*ca987d46SWarner Losh.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 48*ca987d46SWarner LoshCFLAGS+= -DLOADER_EXT2FS_SUPPORT 49*ca987d46SWarner Losh.endif 50*ca987d46SWarner Losh.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 51*ca987d46SWarner LoshCFLAGS+= -DLOADER_MSDOS_SUPPORT 52*ca987d46SWarner Losh.endif 53*ca987d46SWarner Losh.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 54*ca987d46SWarner LoshCFLAGS+= -DLOADER_NANDFS_SUPPORT 55*ca987d46SWarner Losh.endif 56*ca987d46SWarner Losh.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 57*ca987d46SWarner LoshCFLAGS+= -DLOADER_UFS_SUPPORT 58*ca987d46SWarner Losh.endif 59*ca987d46SWarner Losh 60*ca987d46SWarner Losh# Compression 61*ca987d46SWarner Losh.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 62*ca987d46SWarner LoshCFLAGS+= -DLOADER_GZIP_SUPPORT 63*ca987d46SWarner Losh.endif 64*ca987d46SWarner Losh.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 65*ca987d46SWarner LoshCFLAGS+= -DLOADER_BZIP2_SUPPORT 66*ca987d46SWarner Losh.endif 67*ca987d46SWarner Losh 68*ca987d46SWarner Losh# Network related things 69*ca987d46SWarner Losh.if ${LOADER_NET_SUPPORT:Uno} == "yes" 70*ca987d46SWarner LoshCFLAGS+= -DLOADER_NET_SUPPORT 71*ca987d46SWarner Losh.endif 72*ca987d46SWarner Losh.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 73*ca987d46SWarner LoshCFLAGS+= -DLOADER_NFS_SUPPORT 74*ca987d46SWarner Losh.endif 75*ca987d46SWarner Losh.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 76*ca987d46SWarner LoshCFLAGS+= -DLOADER_TFTP_SUPPORT 77*ca987d46SWarner Losh.endif 78*ca987d46SWarner Losh 79*ca987d46SWarner Losh# Disk and partition support 80*ca987d46SWarner Losh.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 81*ca987d46SWarner LoshCFLAGS+= -DLOADER_DISK_SUPPORT 82*ca987d46SWarner Losh.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 83*ca987d46SWarner LoshCFLAGS+= -DLOADER_GPT_SUPPORT 84*ca987d46SWarner Losh.endif 85*ca987d46SWarner Losh.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 86*ca987d46SWarner LoshCFLAGS+= -DLOADER_MBR_SUPPORT 87*ca987d46SWarner Losh.endif 88*ca987d46SWarner Losh 89*ca987d46SWarner Losh# GELI Support, with backward compat hooks 90*ca987d46SWarner Losh.if defined(HAVE_GELI) 91*ca987d46SWarner Losh.if defined(LOADER_NO_GELI_SUPPORT) 92*ca987d46SWarner LoshMK_LOADER_GELI=no 93*ca987d46SWarner Losh.warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" 94*ca987d46SWarner Losh.endif 95*ca987d46SWarner Losh.if defined(LOADER_GELI_SUPPORT) 96*ca987d46SWarner LoshMK_LOADER_GELI=yes 97*ca987d46SWarner Losh.warning "Please move from LOADER_GELI_SUPPORT to WITH_LOADER_GELI" 98*ca987d46SWarner Losh.endif 99*ca987d46SWarner Losh.if ${MK_LOADER_GELI} == "yes" 100*ca987d46SWarner LoshCFLAGS+= -DLOADER_GELI_SUPPORT 101*ca987d46SWarner LoshCFLAGS+= -I${BOOTSRC}/geli 102*ca987d46SWarner LoshLIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a 103*ca987d46SWarner Losh.endif 104*ca987d46SWarner Losh.endif 105*ca987d46SWarner Losh.endif 106*ca987d46SWarner Losh 107*ca987d46SWarner LoshCFLAGS+= -I${SYSDIR} 108*ca987d46SWarner Losh 109*ca987d46SWarner Losh# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc 110*ca987d46SWarner Losh# or powerpc64. 111*ca987d46SWarner Losh.if ${MACHINE_ARCH} == "powerpc64" 112*ca987d46SWarner LoshCFLAGS+= -m32 -mcpu=powerpc 113*ca987d46SWarner Losh.endif 114*ca987d46SWarner Losh 115*ca987d46SWarner Losh# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is 116*ca987d46SWarner Losh# build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here 117*ca987d46SWarner Losh# and activate it when DO32 is explicitly defined to be 1. 118*ca987d46SWarner Losh.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 119*ca987d46SWarner LoshCFLAGS+= -m32 -mcpu=i386 120*ca987d46SWarner Losh# LD_FLAGS is passed directly to ${LD}, not via ${CC}: 121*ca987d46SWarner LoshLD_FLAGS+= -m elf_i386_fbsd 122*ca987d46SWarner LoshAFLAGS+= --32 123*ca987d46SWarner Losh.endif 124*ca987d46SWarner Losh 125*ca987d46SWarner Losh# Make sure we use the machine link we're about to create 126*ca987d46SWarner LoshCFLAGS+=-I. 127*ca987d46SWarner Losh 128*ca987d46SWarner Losh_ILINKS=machine 129*ca987d46SWarner Losh.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" 130*ca987d46SWarner Losh_ILINKS+=${MACHINE_CPUARCH} 131*ca987d46SWarner Losh.endif 132*ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 133*ca987d46SWarner Losh_ILINKS+=x86 134*ca987d46SWarner Losh.endif 135*ca987d46SWarner LoshCLEANFILES+=${_ILINKS} 136*ca987d46SWarner Losh 137*ca987d46SWarner Loshall: ${PROG} 138*ca987d46SWarner Losh 139*ca987d46SWarner Loshbeforedepend: ${_ILINKS} 140*ca987d46SWarner Loshbeforebuild: ${_ILINKS} 141*ca987d46SWarner Losh 142*ca987d46SWarner Losh# Ensure that the links exist without depending on it when it exists which 143*ca987d46SWarner Losh# causes all the modules to be rebuilt when the directory pointed to changes. 144*ca987d46SWarner Losh.for _link in ${_ILINKS} 145*ca987d46SWarner Losh.if !exists(${.OBJDIR}/${_link}) 146*ca987d46SWarner Losh${OBJS}: ${_link} 147*ca987d46SWarner Losh.endif 148*ca987d46SWarner Losh.endfor 149*ca987d46SWarner Losh 150*ca987d46SWarner Losh.NOPATH: ${_ILINKS} 151*ca987d46SWarner Losh 152*ca987d46SWarner Losh${_ILINKS}: 153*ca987d46SWarner Losh @case ${.TARGET} in \ 154*ca987d46SWarner Losh machine) \ 155*ca987d46SWarner Losh if [ ${DO32:U0} -eq 0 ]; then \ 156*ca987d46SWarner Losh path=${SYSDIR}/${MACHINE}/include ; \ 157*ca987d46SWarner Losh else \ 158*ca987d46SWarner Losh path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \ 159*ca987d46SWarner Losh fi ;; \ 160*ca987d46SWarner Losh *) \ 161*ca987d46SWarner Losh path=${SYSDIR}/${.TARGET:T}/include ;; \ 162*ca987d46SWarner Losh esac ; \ 163*ca987d46SWarner Losh path=`(cd $$path && /bin/pwd)` ; \ 164*ca987d46SWarner Losh ${ECHO} ${.TARGET:T} "->" $$path ; \ 165*ca987d46SWarner Losh ln -fhs $$path ${.TARGET:T} 166*ca987d46SWarner Losh 167*ca987d46SWarner Losh# For loader implementations, we generate a loader.help file. This can be suppressed by 168*ca987d46SWarner Losh# setting HELP_FILES to nothing. 169*ca987d46SWarner LoshHELP_FILES= ${LDRSRC}/help.common 170*ca987d46SWarner Losh 171*ca987d46SWarner Losh.endif # __BOOT_DEFS_MK__ 172