defs.mk revision 329140
1324651Simp# $FreeBSD: stable/11/sys/boot/defs.mk 329140 2018-02-11 20:58:00Z kevans $ 2324651Simp 3324652Simp.include <src.opts.mk> 4324652Simp 5324651Simp.if !defined(__BOOT_DEFS_MK__) 6324651Simp__BOOT_DEFS_MK__=${MFILE} 7324651Simp 8329140SkevansBOOTSRC= ${SRCTOP}/sys/boot 9329140SkevansEFISRC= ${BOOTSRC}/efi 10329140SkevansEFIINC= ${EFISRC}/include 11329140SkevansEFIINCMD= ${EFIINC}/${MACHINE} 12329140SkevansFDTSRC= ${BOOTSRC}/fdt 13329140SkevansFICLSRC= ${BOOTSRC}/ficl 14329140SkevansLDRSRC= ${BOOTSRC}/common 15329140SkevansSASRC= ${BOOTSRC}/libsa 16324651SimpSYSDIR= ${SRCTOP}/sys 17329140SkevansUBOOTSRC= ${BOOTSRC}/uboot 18329140SkevansZFSSRC= ${BOOTSRC}/zfs 19324651Simp 20329140SkevansBOOTOBJ= ${OBJTOP}/sys/boot 21329140Skevans 22329140Skevans# BINDIR is where we install 23329140SkevansBINDIR?= /boot 24329140Skevans 25324652Simp# NB: The makefiles depend on these being empty when we don't build forth. 26324652Simp.if ${MK_FORTH} != "no" 27329140SkevansLIBFICL= ${BOOTOBJ}/ficl/libficl.a 28329140Skevans.if ${MACHINE} == "i386" 29329140SkevansLIBFICL32= ${LIBFICL} 30329140Skevans.else 31329140SkevansLIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 32324652Simp.endif 33329140Skevans.endif 34329140SkevansLIBSA= ${BOOTOBJ}/libsa/libsa.a 35329140Skevans.if ${MACHINE} == "i386" 36329140SkevansLIBSA32= ${LIBSA} 37329140Skevans.else 38329140SkevansLIBSA32= ${BOOTOBJ}/libsa32/libsa32.a 39329140Skevans.endif 40324651Simp 41324653Simp# Standard options: 42324653Simp 43324653Simp# Filesystem support 44324653Simp.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 45324653SimpCFLAGS+= -DLOADER_CD9660_SUPPORT 46324653Simp.endif 47324653Simp.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 48324653SimpCFLAGS+= -DLOADER_EXT2FS_SUPPORT 49324653Simp.endif 50324653Simp.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 51324653SimpCFLAGS+= -DLOADER_MSDOS_SUPPORT 52324653Simp.endif 53324653Simp.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 54324653SimpCFLAGS+= -DLOADER_NANDFS_SUPPORT 55324653Simp.endif 56324653Simp.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 57324653SimpCFLAGS+= -DLOADER_UFS_SUPPORT 58324653Simp.endif 59324653Simp 60324653Simp# Compression 61324653Simp.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 62324653SimpCFLAGS+= -DLOADER_GZIP_SUPPORT 63324653Simp.endif 64324653Simp.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 65324653SimpCFLAGS+= -DLOADER_BZIP2_SUPPORT 66324653Simp.endif 67324653Simp 68324653Simp# Network related things 69324653Simp.if ${LOADER_NET_SUPPORT:Uno} == "yes" 70324653SimpCFLAGS+= -DLOADER_NET_SUPPORT 71324653Simp.endif 72324653Simp.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 73324653SimpCFLAGS+= -DLOADER_NFS_SUPPORT 74324653Simp.endif 75324653Simp.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 76324653SimpCFLAGS+= -DLOADER_TFTP_SUPPORT 77324653Simp.endif 78324653Simp 79324653Simp# Disk and partition support 80324653Simp.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 81324653SimpCFLAGS+= -DLOADER_DISK_SUPPORT 82324653Simp.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 83324653SimpCFLAGS+= -DLOADER_GPT_SUPPORT 84324653Simp.endif 85324653Simp.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 86324653SimpCFLAGS+= -DLOADER_MBR_SUPPORT 87324653Simp.endif 88329140Skevans 89329140Skevans# GELI Support, with backward compat hooks 90329140Skevans.if defined(HAVE_GELI) 91329140Skevans.if defined(LOADER_NO_GELI_SUPPORT) 92329140SkevansMK_LOADER_GELI=no 93329140Skevans.warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI" 94324653Simp.endif 95329140Skevans.if defined(LOADER_GELI_SUPPORT) 96329140SkevansMK_LOADER_GELI=yes 97329140Skevans.warning "Please move from LOADER_GELI_SUPPORT to WITH_LOADER_GELI" 98324653Simp.endif 99329140Skevans.if ${MK_LOADER_GELI} == "yes" 100329140SkevansCFLAGS+= -DLOADER_GELI_SUPPORT 101329140SkevansCFLAGS+= -I${BOOTSRC}/geli 102329140SkevansLIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a 103329140Skevans.endif 104329140Skevans.endif 105329140Skevans.endif 106324653Simp 107329140SkevansCFLAGS+= -I${SYSDIR} 108329140Skevans 109329140Skevans# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc 110329140Skevans# or powerpc64. 111329140Skevans.if ${MACHINE_ARCH} == "powerpc64" 112329140SkevansCFLAGS+= -m32 -mcpu=powerpc 113329140Skevans.endif 114329140Skevans 115329140Skevans# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is 116329140Skevans# build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here 117329140Skevans# and activate it when DO32 is explicitly defined to be 1. 118329140Skevans.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 119329140SkevansCFLAGS+= -m32 -mcpu=i386 120329140Skevans# LD_FLAGS is passed directly to ${LD}, not via ${CC}: 121329140SkevansLD_FLAGS+= -m elf_i386_fbsd 122329140SkevansAFLAGS+= --32 123329140Skevans.endif 124329140Skevans 125329140Skevans# Make sure we use the machine link we're about to create 126329140SkevansCFLAGS+=-I. 127329140Skevans 128329140Skevans_ILINKS=machine 129329140Skevans.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" 130329140Skevans_ILINKS+=${MACHINE_CPUARCH} 131329140Skevans.endif 132329140Skevans.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 133329140Skevans_ILINKS+=x86 134329140Skevans.endif 135329140SkevansCLEANFILES+=${_ILINKS} 136329140Skevans 137329140Skevansall: ${PROG} 138329140Skevans 139329140Skevansbeforedepend: ${_ILINKS} 140329140Skevansbeforebuild: ${_ILINKS} 141329140Skevans 142329140Skevans# Ensure that the links exist without depending on it when it exists which 143329140Skevans# causes all the modules to be rebuilt when the directory pointed to changes. 144329140Skevans.for _link in ${_ILINKS} 145329140Skevans.if !exists(${.OBJDIR}/${_link}) 146329140Skevans${OBJS}: ${_link} 147329140Skevans.endif 148329140Skevans.endfor 149329140Skevans 150329140Skevans.NOPATH: ${_ILINKS} 151329140Skevans 152329140Skevans${_ILINKS}: 153329140Skevans @case ${.TARGET} in \ 154329140Skevans machine) \ 155329140Skevans if [ ${DO32:U0} -eq 0 ]; then \ 156329140Skevans path=${SYSDIR}/${MACHINE}/include ; \ 157329140Skevans else \ 158329140Skevans path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \ 159329140Skevans fi ;; \ 160329140Skevans *) \ 161329140Skevans path=${SYSDIR}/${.TARGET:T}/include ;; \ 162329140Skevans esac ; \ 163329140Skevans path=`(cd $$path && /bin/pwd)` ; \ 164329140Skevans ${ECHO} ${.TARGET:T} "->" $$path ; \ 165329140Skevans ln -fhs $$path ${.TARGET:T} 166329140Skevans 167329140Skevans# For loader implementations, we generate a loader.help file. This can be suppressed by 168329140Skevans# setting HELP_FILES to nothing. 169329140SkevansHELP_FILES= ${LDRSRC}/help.common 170329140Skevans 171324651Simp.endif # __BOOT_DEFS_MK__ 172