1# $FreeBSD$ 2 3.include "defs.mk" 4 5.PATH: ${LDRSRC} ${BOOTSRC}/libsa 6 7CFLAGS+=-I${LDRSRC} 8 9SRCS+= boot.c commands.c console.c devopen.c interp.c 10SRCS+= interp_backslash.c interp_parse.c ls.c misc.c 11SRCS+= module.c 12 13.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 14SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 15SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 16.elif ${MACHINE_CPUARCH} == "aarch64" 17SRCS+= load_elf64.c reloc_elf64.c 18.elif ${MACHINE_CPUARCH} == "arm" 19SRCS+= load_elf32.c reloc_elf32.c 20.elif ${MACHINE_CPUARCH} == "powerpc" 21SRCS+= load_elf32.c reloc_elf32.c 22SRCS+= load_elf64.c reloc_elf64.c 23.elif ${MACHINE_CPUARCH} == "sparc64" 24SRCS+= load_elf64.c reloc_elf64.c 25.elif ${MACHINE_ARCH:Mmips64*} != "" 26SRCS+= load_elf64.c reloc_elf64.c 27.elif ${MACHINE} == "mips" 28SRCS+= load_elf32.c reloc_elf32.c 29.endif 30 31.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 32SRCS+= disk.c part.c 33.endif 34 35.if ${LOADER_NET_SUPPORT:Uno} == "yes" 36SRCS+= dev_net.c 37.endif 38 39.if defined(HAVE_BCACHE) 40SRCS+= bcache.c 41.endif 42 43.if defined(MD_IMAGE_SIZE) 44CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 45SRCS+= md.c 46.else 47CLEANFILES+= md.o 48.endif 49 50# Machine-independant ISA PnP 51.if defined(HAVE_ISABUS) 52SRCS+= isapnp.c 53.endif 54.if defined(HAVE_PNP) 55SRCS+= pnp.c 56.endif 57 58# Forth interpreter 59.if ${MK_FORTH} != "no" 60SRCS+= interp_forth.c 61.include "${BOOTSRC}/ficl.mk" 62.else 63SRCS+= interp_simple.c 64.endif 65 66.if defined(BOOT_PROMPT_123) 67CFLAGS+= -DBOOT_PROMPT_123 68.endif 69 70.if defined(LOADER_INSTALL_SUPPORT) 71SRCS+= install.c 72.endif 73 74# Filesystem support 75.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 76CFLAGS+= -DLOADER_CD9660_SUPPORT 77.endif 78.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 79CFLAGS+= -DLOADER_EXT2FS_SUPPORT 80.endif 81.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 82CFLAGS+= -DLOADER_MSDOS_SUPPORT 83.endif 84.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 85CFLAGS+= -DLOADER_NANDFS_SUPPORT 86.endif 87.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 88CFLAGS+= -DLOADER_UFS_SUPPORT 89.endif 90 91# Compression 92.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 93CFLAGS+= -DLOADER_GZIP_SUPPORT 94.endif 95.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 96CFLAGS+= -DLOADER_BZIP2_SUPPORT 97.endif 98 99# Network related things 100.if ${LOADER_NET_SUPPORT:Uno} == "yes" 101CFLAGS+= -DLOADER_NET_SUPPORT 102.endif 103.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 104CFLAGS+= -DLOADER_NFS_SUPPORT 105.endif 106.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 107CFLAGS+= -DLOADER_TFTP_SUPPORT 108.endif 109 110# Partition support 111.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 112CFLAGS+= -DLOADER_GPT_SUPPORT 113.endif 114.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 115CFLAGS+= -DLOADER_MBR_SUPPORT 116.endif 117 118.if defined(HAVE_ZFS) 119CFLAGS+= -DLOADER_ZFS_SUPPORT 120CFLAGS+= -I${ZFSSRC} 121CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 122.if ${MACHINE} == "amd64" 123# Have to override to use 32-bit version of zfs library... 124# kinda lame to select that there XXX 125LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a 126.else 127LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a 128.endif 129.endif 130 131LIBFICL= ${BOOTOBJ}/ficl/libficl.a 132.if ${MACHINE} == "i386" 133LIBFICL32= ${LIBFICL} 134.else 135LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 136.endif 137.if ${MK_FORTH} != no 138LDR_INTERP= ${LIBFICL} 139LDR_INTERP32= ${LIBFICL32} 140.endif 141 142CLEANFILES+= vers.c 143VERSION_FILE?= ${.CURDIR}/version 144.if ${MK_REPRODUCIBLE_BUILD} != no 145REPRO_FLAG= -r 146.endif 147vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 148 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 149 ${NEWVERSWHAT} 150 151.if !empty(HELP_FILES) 152HELP_FILES+= ${LDRSRC}/help.common 153 154CLEANFILES+= loader.help 155FILES+= loader.help 156 157loader.help: ${HELP_FILES} 158 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 159.endif 160