1ca987d46SWarner Losh# $FreeBSD$ 2ca987d46SWarner Losh 3ca987d46SWarner Losh.PATH: ${LDRSRC} ${BOOTSRC}/libsa 4ca987d46SWarner Losh 5ca987d46SWarner LoshCFLAGS+=-I${LDRSRC} 6ca987d46SWarner Losh 7ca987d46SWarner LoshSRCS+= boot.c commands.c console.c devopen.c interp.c 8ca987d46SWarner LoshSRCS+= interp_backslash.c interp_parse.c ls.c misc.c 9*a3479cfdSToomas SoomeSRCS+= module.c nvstore.c pnglite.c 10ca987d46SWarner Losh 113630506bSToomas SoomeCFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite 123630506bSToomas Soome 13*a3479cfdSToomas Soome.PATH: ${SRCTOP}/contrib/pnglite 14*a3479cfdSToomas SoomeCFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite 15*a3479cfdSToomas SoomeCFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 16*a3479cfdSToomas Soome 17ca987d46SWarner Losh.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 18ca987d46SWarner LoshSRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 19ca987d46SWarner LoshSRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 20ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "aarch64" 21ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 22ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "arm" 23ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 24ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "powerpc" 25ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 26ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 27d3e1307bSJustin HibbitsSRCS+= metadata.c 28ca987d46SWarner Losh.elif ${MACHINE_ARCH:Mmips64*} != "" 29ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 30d3e1307bSJustin HibbitsSRCS+= metadata.c 31ca987d46SWarner Losh.elif ${MACHINE} == "mips" 32ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 33d3e1307bSJustin HibbitsSRCS+= metadata.c 342192efc0SMitchell Horne.elif ${MACHINE_CPUARCH} == "riscv" 352192efc0SMitchell HorneSRCS+= load_elf64.c reloc_elf64.c 362192efc0SMitchell HorneSRCS+= metadata.c 37ca987d46SWarner Losh.endif 38ca987d46SWarner Losh 39ca987d46SWarner Losh.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 4027bae615SToomas SoomeCFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 414914ee11SToomas SoomeSRCS+= disk.c part.c vdisk.c 42ca987d46SWarner Losh.endif 43ca987d46SWarner Losh 44ca987d46SWarner Losh.if ${LOADER_NET_SUPPORT:Uno} == "yes" 45ca987d46SWarner LoshSRCS+= dev_net.c 46ca987d46SWarner Losh.endif 47ca987d46SWarner Losh 48ca987d46SWarner Losh.if defined(HAVE_BCACHE) 49ca987d46SWarner LoshSRCS+= bcache.c 50ca987d46SWarner Losh.endif 51ca987d46SWarner Losh 52ca987d46SWarner Losh.if defined(MD_IMAGE_SIZE) 53ca987d46SWarner LoshCFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 54ca987d46SWarner LoshSRCS+= md.c 55ca987d46SWarner Losh.else 56ca987d46SWarner LoshCLEANFILES+= md.o 57ca987d46SWarner Losh.endif 58ca987d46SWarner Losh 59ca987d46SWarner Losh# Machine-independant ISA PnP 60ca987d46SWarner Losh.if defined(HAVE_ISABUS) 61ca987d46SWarner LoshSRCS+= isapnp.c 62ca987d46SWarner Losh.endif 63ca987d46SWarner Losh.if defined(HAVE_PNP) 64ca987d46SWarner LoshSRCS+= pnp.c 65ca987d46SWarner Losh.endif 66ca987d46SWarner Losh 679d45c24cSWarner Losh.if ${LOADER_INTERP} == "lua" 687cafeaa1SWarner LoshSRCS+= interp_lua.c 697cafeaa1SWarner Losh.include "${BOOTSRC}/lua.mk" 707cafeaa1SWarner LoshLDR_INTERP= ${LIBLUA} 717cafeaa1SWarner LoshLDR_INTERP32= ${LIBLUA32} 72506f3640SKyle EvansCFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules 739d45c24cSWarner Losh.elif ${LOADER_INTERP} == "4th" 74ca987d46SWarner LoshSRCS+= interp_forth.c 75ca987d46SWarner Losh.include "${BOOTSRC}/ficl.mk" 767cafeaa1SWarner LoshLDR_INTERP= ${LIBFICL} 777cafeaa1SWarner LoshLDR_INTERP32= ${LIBFICL32} 789d45c24cSWarner Losh.elif ${LOADER_INTERP} == "simp" 7979a6a17aSWarner LoshSRCS+= interp_simple.c 809d45c24cSWarner Losh.else 819d45c24cSWarner Losh.error Unknown interpreter ${LOADER_INTERP} 82ca987d46SWarner Losh.endif 83ca987d46SWarner Losh 848df8b2d3SSimon J. Gerraty.if ${MK_LOADER_VERIEXEC} != "no" 858df8b2d3SSimon J. GerratyCFLAGS+= -DLOADER_VERIEXEC -I${SRCTOP}/lib/libsecureboot/h 86afc571b1SSimon J. Gerraty.if ${MK_LOADER_VERIEXEC_VECTX} != "no" 87afc571b1SSimon J. GerratyCFLAGS+= -DLOADER_VERIEXEC_VECTX 88afc571b1SSimon J. Gerraty.endif 898df8b2d3SSimon J. Gerraty.endif 908df8b2d3SSimon J. Gerraty 91b0fefb25SMarcin Wojtas.if ${MK_LOADER_VERIEXEC_PASS_MANIFEST} != "no" 92b0fefb25SMarcin WojtasCFLAGS+= -DLOADER_VERIEXEC_PASS_MANIFEST -I${SRCTOP}/lib/libsecureboot/h 93b0fefb25SMarcin Wojtas.endif 94b0fefb25SMarcin Wojtas 95ca987d46SWarner Losh.if defined(BOOT_PROMPT_123) 96ca987d46SWarner LoshCFLAGS+= -DBOOT_PROMPT_123 97ca987d46SWarner Losh.endif 98ca987d46SWarner Losh 99ca987d46SWarner Losh.if defined(LOADER_INSTALL_SUPPORT) 100ca987d46SWarner LoshSRCS+= install.c 101ca987d46SWarner Losh.endif 102ca987d46SWarner Losh 1034927bbceSWarner Losh# Filesystem support 1044927bbceSWarner Losh.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 1054927bbceSWarner LoshCFLAGS+= -DLOADER_CD9660_SUPPORT 1064927bbceSWarner Losh.endif 1074927bbceSWarner Losh.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 1084927bbceSWarner LoshCFLAGS+= -DLOADER_EXT2FS_SUPPORT 1094927bbceSWarner Losh.endif 1104927bbceSWarner Losh.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 1114927bbceSWarner LoshCFLAGS+= -DLOADER_MSDOS_SUPPORT 1124927bbceSWarner Losh.endif 1134927bbceSWarner Losh.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 1144927bbceSWarner LoshCFLAGS+= -DLOADER_UFS_SUPPORT 1154927bbceSWarner Losh.endif 1164927bbceSWarner Losh 1174927bbceSWarner Losh# Compression 1184927bbceSWarner Losh.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 1194927bbceSWarner LoshCFLAGS+= -DLOADER_GZIP_SUPPORT 1204927bbceSWarner Losh.endif 1214927bbceSWarner Losh.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 1224927bbceSWarner LoshCFLAGS+= -DLOADER_BZIP2_SUPPORT 1234927bbceSWarner Losh.endif 1244927bbceSWarner Losh 1254927bbceSWarner Losh# Network related things 1264927bbceSWarner Losh.if ${LOADER_NET_SUPPORT:Uno} == "yes" 1274927bbceSWarner LoshCFLAGS+= -DLOADER_NET_SUPPORT 1284927bbceSWarner Losh.endif 1294927bbceSWarner Losh.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 1304927bbceSWarner LoshCFLAGS+= -DLOADER_NFS_SUPPORT 1314927bbceSWarner Losh.endif 1324927bbceSWarner Losh.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 1334927bbceSWarner LoshCFLAGS+= -DLOADER_TFTP_SUPPORT 1344927bbceSWarner Losh.endif 1354927bbceSWarner Losh 1368701bb8fSWarner Losh# Partition support 1374927bbceSWarner Losh.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 1384927bbceSWarner LoshCFLAGS+= -DLOADER_GPT_SUPPORT 1394927bbceSWarner Losh.endif 1404927bbceSWarner Losh.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 1414927bbceSWarner LoshCFLAGS+= -DLOADER_MBR_SUPPORT 1424927bbceSWarner Losh.endif 1434927bbceSWarner Losh 144060679efSWarner Losh.if ${HAVE_ZFS:Uno} == "yes" 145ca987d46SWarner LoshCFLAGS+= -DLOADER_ZFS_SUPPORT 146ca987d46SWarner LoshCFLAGS+= -I${ZFSSRC} 147ca987d46SWarner LoshCFLAGS+= -I${SYSDIR}/cddl/boot/zfs 1483830659eSToomas SoomeCFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common 1494784aef9SWarner LoshSRCS+= zfs_cmd.c 150ca987d46SWarner Losh.endif 151ca987d46SWarner Losh 15276a8f5b0SWarner LoshLIBFICL= ${BOOTOBJ}/ficl/libficl.a 15376a8f5b0SWarner Losh.if ${MACHINE} == "i386" 15476a8f5b0SWarner LoshLIBFICL32= ${LIBFICL} 15576a8f5b0SWarner Losh.else 15676a8f5b0SWarner LoshLIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 15776a8f5b0SWarner Losh.endif 1587cafeaa1SWarner Losh 1597cafeaa1SWarner LoshLIBLUA= ${BOOTOBJ}/liblua/liblua.a 1607cafeaa1SWarner Losh.if ${MACHINE} == "i386" 161cc8ea7cfSKyle EvansLIBLUA32= ${LIBLUA} 1627cafeaa1SWarner Losh.else 1637cafeaa1SWarner LoshLIBLUA32= ${BOOTOBJ}/liblua32/liblua.a 16476a8f5b0SWarner Losh.endif 16576a8f5b0SWarner Losh 166ca987d46SWarner LoshCLEANFILES+= vers.c 167ca987d46SWarner LoshVERSION_FILE?= ${.CURDIR}/version 168ca987d46SWarner Losh.if ${MK_REPRODUCIBLE_BUILD} != no 169ca987d46SWarner LoshREPRO_FLAG= -r 170ca987d46SWarner Losh.endif 171ca987d46SWarner Loshvers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 172ca987d46SWarner Losh sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 173ca987d46SWarner Losh ${NEWVERSWHAT} 174ca987d46SWarner Losh 175f871c5d9SWarner Losh.if ${MK_LOADER_VERBOSE} != "no" 176f871c5d9SWarner LoshCFLAGS+= -DELF_VERBOSE 177f871c5d9SWarner Losh.endif 178f871c5d9SWarner Losh 179ca987d46SWarner Losh.if !empty(HELP_FILES) 18025c2f4cbSWarner LoshHELP_FILES+= ${LDRSRC}/help.common 18125c2f4cbSWarner Losh 182ca987d46SWarner LoshCLEANFILES+= loader.help 183ca987d46SWarner LoshFILES+= loader.help 184ca987d46SWarner Losh 185ca987d46SWarner Loshloader.help: ${HELP_FILES} 186ca987d46SWarner Losh cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 187ca987d46SWarner Losh.endif 188