1ca987d46SWarner Losh# $FreeBSD$ 2ca987d46SWarner Losh 3ca987d46SWarner Losh.include "defs.mk" 4ca987d46SWarner Losh 5ca987d46SWarner Losh.PATH: ${LDRSRC} ${BOOTSRC}/libsa 6ca987d46SWarner Losh 7ca987d46SWarner LoshCFLAGS+=-I${LDRSRC} 8ca987d46SWarner Losh 9ca987d46SWarner LoshSRCS+= boot.c commands.c console.c devopen.c interp.c 10ca987d46SWarner LoshSRCS+= interp_backslash.c interp_parse.c ls.c misc.c 11ca987d46SWarner LoshSRCS+= module.c 12ca987d46SWarner Losh 13ca987d46SWarner Losh.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 14ca987d46SWarner LoshSRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 15ca987d46SWarner LoshSRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 16ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "aarch64" 17ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 18ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "arm" 19ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 20ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "powerpc" 21ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 22ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 23ca987d46SWarner Losh.elif ${MACHINE_CPUARCH} == "sparc64" 24ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 25ca987d46SWarner Losh.elif ${MACHINE_ARCH:Mmips64*} != "" 26ca987d46SWarner LoshSRCS+= load_elf64.c reloc_elf64.c 27ca987d46SWarner Losh.elif ${MACHINE} == "mips" 28ca987d46SWarner LoshSRCS+= load_elf32.c reloc_elf32.c 29ca987d46SWarner Losh.endif 30ca987d46SWarner Losh 31ca987d46SWarner Losh.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 32ca987d46SWarner LoshSRCS+= disk.c part.c 33ca987d46SWarner Losh.endif 34ca987d46SWarner Losh 35ca987d46SWarner Losh.if ${LOADER_NET_SUPPORT:Uno} == "yes" 36ca987d46SWarner LoshSRCS+= dev_net.c 37ca987d46SWarner Losh.endif 38ca987d46SWarner Losh 39ca987d46SWarner Losh.if defined(HAVE_BCACHE) 40ca987d46SWarner LoshSRCS+= bcache.c 41ca987d46SWarner Losh.endif 42ca987d46SWarner Losh 43ca987d46SWarner Losh.if defined(MD_IMAGE_SIZE) 44ca987d46SWarner LoshCFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 45ca987d46SWarner LoshSRCS+= md.c 46ca987d46SWarner Losh.else 47ca987d46SWarner LoshCLEANFILES+= md.o 48ca987d46SWarner Losh.endif 49ca987d46SWarner Losh 50ca987d46SWarner Losh# Machine-independant ISA PnP 51ca987d46SWarner Losh.if defined(HAVE_ISABUS) 52ca987d46SWarner LoshSRCS+= isapnp.c 53ca987d46SWarner Losh.endif 54ca987d46SWarner Losh.if defined(HAVE_PNP) 55ca987d46SWarner LoshSRCS+= pnp.c 56ca987d46SWarner Losh.endif 57ca987d46SWarner Losh 58ca987d46SWarner Losh# Forth interpreter 59*7cafeaa1SWarner Losh.if ${MK_LOADER_LUA} != "no" 60*7cafeaa1SWarner LoshSRCS+= interp_lua.c 61*7cafeaa1SWarner Losh.include "${BOOTSRC}/lua.mk" 62*7cafeaa1SWarner LoshLDR_INTERP= ${LIBLUA} 63*7cafeaa1SWarner LoshLDR_INTERP32= ${LIBLUA32} 64*7cafeaa1SWarner Losh.elif ${MK_FORTH} != "no" 65ca987d46SWarner LoshSRCS+= interp_forth.c 66ca987d46SWarner Losh.include "${BOOTSRC}/ficl.mk" 67*7cafeaa1SWarner LoshLDR_INTERP= ${LIBFICL} 68*7cafeaa1SWarner LoshLDR_INTERP32= ${LIBFICL32} 6979a6a17aSWarner Losh.else 7079a6a17aSWarner LoshSRCS+= interp_simple.c 71ca987d46SWarner Losh.endif 72ca987d46SWarner Losh 73ca987d46SWarner Losh.if defined(BOOT_PROMPT_123) 74ca987d46SWarner LoshCFLAGS+= -DBOOT_PROMPT_123 75ca987d46SWarner Losh.endif 76ca987d46SWarner Losh 77ca987d46SWarner Losh.if defined(LOADER_INSTALL_SUPPORT) 78ca987d46SWarner LoshSRCS+= install.c 79ca987d46SWarner Losh.endif 80ca987d46SWarner Losh 814927bbceSWarner Losh# Filesystem support 824927bbceSWarner Losh.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 834927bbceSWarner LoshCFLAGS+= -DLOADER_CD9660_SUPPORT 844927bbceSWarner Losh.endif 854927bbceSWarner Losh.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 864927bbceSWarner LoshCFLAGS+= -DLOADER_EXT2FS_SUPPORT 874927bbceSWarner Losh.endif 884927bbceSWarner Losh.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 894927bbceSWarner LoshCFLAGS+= -DLOADER_MSDOS_SUPPORT 904927bbceSWarner Losh.endif 914927bbceSWarner Losh.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 924927bbceSWarner LoshCFLAGS+= -DLOADER_NANDFS_SUPPORT 934927bbceSWarner Losh.endif 944927bbceSWarner Losh.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 954927bbceSWarner LoshCFLAGS+= -DLOADER_UFS_SUPPORT 964927bbceSWarner Losh.endif 974927bbceSWarner Losh 984927bbceSWarner Losh# Compression 994927bbceSWarner Losh.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 1004927bbceSWarner LoshCFLAGS+= -DLOADER_GZIP_SUPPORT 1014927bbceSWarner Losh.endif 1024927bbceSWarner Losh.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 1034927bbceSWarner LoshCFLAGS+= -DLOADER_BZIP2_SUPPORT 1044927bbceSWarner Losh.endif 1054927bbceSWarner Losh 1064927bbceSWarner Losh# Network related things 1074927bbceSWarner Losh.if ${LOADER_NET_SUPPORT:Uno} == "yes" 1084927bbceSWarner LoshCFLAGS+= -DLOADER_NET_SUPPORT 1094927bbceSWarner Losh.endif 1104927bbceSWarner Losh.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 1114927bbceSWarner LoshCFLAGS+= -DLOADER_NFS_SUPPORT 1124927bbceSWarner Losh.endif 1134927bbceSWarner Losh.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 1144927bbceSWarner LoshCFLAGS+= -DLOADER_TFTP_SUPPORT 1154927bbceSWarner Losh.endif 1164927bbceSWarner Losh 1178701bb8fSWarner Losh# Partition support 1184927bbceSWarner Losh.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 1194927bbceSWarner LoshCFLAGS+= -DLOADER_GPT_SUPPORT 1204927bbceSWarner Losh.endif 1214927bbceSWarner Losh.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 1224927bbceSWarner LoshCFLAGS+= -DLOADER_MBR_SUPPORT 1234927bbceSWarner Losh.endif 1244927bbceSWarner Losh 125ca987d46SWarner Losh.if defined(HAVE_ZFS) 126ca987d46SWarner LoshCFLAGS+= -DLOADER_ZFS_SUPPORT 127ca987d46SWarner LoshCFLAGS+= -I${ZFSSRC} 128ca987d46SWarner LoshCFLAGS+= -I${SYSDIR}/cddl/boot/zfs 129ca987d46SWarner Losh.if ${MACHINE} == "amd64" 130ca987d46SWarner Losh# Have to override to use 32-bit version of zfs library... 131ca987d46SWarner Losh# kinda lame to select that there XXX 132ca987d46SWarner LoshLIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a 133ca987d46SWarner Losh.else 134ca987d46SWarner LoshLIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a 135ca987d46SWarner Losh.endif 136ca987d46SWarner Losh.endif 137ca987d46SWarner Losh 13876a8f5b0SWarner LoshLIBFICL= ${BOOTOBJ}/ficl/libficl.a 13976a8f5b0SWarner Losh.if ${MACHINE} == "i386" 14076a8f5b0SWarner LoshLIBFICL32= ${LIBFICL} 14176a8f5b0SWarner Losh.else 14276a8f5b0SWarner LoshLIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 14376a8f5b0SWarner Losh.endif 144*7cafeaa1SWarner Losh 145*7cafeaa1SWarner LoshLIBLUA= ${BOOTOBJ}/liblua/liblua.a 146*7cafeaa1SWarner Losh.if ${MACHINE} == "i386" 147*7cafeaa1SWarner LoshLIBLUA32= ${LIBFICL} 148*7cafeaa1SWarner Losh.else 149*7cafeaa1SWarner LoshLIBLUA32= ${BOOTOBJ}/liblua32/liblua.a 15076a8f5b0SWarner Losh.endif 15176a8f5b0SWarner Losh 152ca987d46SWarner LoshCLEANFILES+= vers.c 153ca987d46SWarner LoshVERSION_FILE?= ${.CURDIR}/version 154ca987d46SWarner Losh.if ${MK_REPRODUCIBLE_BUILD} != no 155ca987d46SWarner LoshREPRO_FLAG= -r 156ca987d46SWarner Losh.endif 157ca987d46SWarner Loshvers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 158ca987d46SWarner Losh sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 159ca987d46SWarner Losh ${NEWVERSWHAT} 160ca987d46SWarner Losh 161ca987d46SWarner Losh.if !empty(HELP_FILES) 16225c2f4cbSWarner LoshHELP_FILES+= ${LDRSRC}/help.common 16325c2f4cbSWarner Losh 164ca987d46SWarner LoshCLEANFILES+= loader.help 165ca987d46SWarner LoshFILES+= loader.help 166ca987d46SWarner Losh 167ca987d46SWarner Loshloader.help: ${HELP_FILES} 168ca987d46SWarner Losh cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 169ca987d46SWarner Losh.endif 170